Replace file() with open()