pyminifier
pyminifier copied to clipboard
Opening a file with an encoding keyword argument in Python 2.7
The line
f = open(options.outfile, 'w', encoding='utf-8')
does not work in Python 2.7. I think this is a result of this commit: de35cbb39f28f6903220f8c7568b95907c64ee40
I have same issue here.
The solution to work properly under Python 3 and Python 2.7 is change the open function which gets used to the open function of the builtin "io" module:
from io import open