I realised that the open() function I've been using was an alias to io.open() and that importing * from os would overshadow that.
open()
io.open()
*
os
What's the difference between opening files through the io module and os module?
io