Issue 2660: Py3k fails to parse a file with an iso-8859-1 string (original) (raw)
While running the 2to3 script on the scons codebase, I ran into an UnicodeDecodeError.
Attached is just the portion of the script that causes the error.
2to3 throws an error on the string regardless of whether the unicode string literal is prepended on the front.
RefactoringTool: Skipping implicit fixer: buffer RefactoringTool: Skipping implicit fixer: idioms RefactoringTool: Skipping implicit fixer: ws_comma Traceback (most recent call last): File "/usr/local/bin/2to3", line 5, in sys.exit(refactor.main()) File "/usr/local/lib/python3.0/lib2to3/refactor.py", line 81, in main rt.refactor_args(args) File "/usr/local/lib/python3.0/lib2to3/refactor.py", line 188, in refactor_args self.refactor_file(arg) File "/usr/local/lib/python3.0/lib2to3/refactor.py", line 217, in refactor_file input = f.read() + "\n" # Silence certain parse errors File "/usr/local/lib/python3.0/io.py", line 1611, in read decoder.decode(self.buffer.read(), final=True)) File "/usr/local/lib/python3.0/io.py", line 1199, in decode output = self.decoder.decode(input, final=final) File "/usr/local/lib/python3.0/codecs.py", line 300, in decode (result, consumed) = self._buffer_decode(data, self.errors, final) UnicodeDecodeError: 'utf8' codec can't decode bytes in position 59-60: invalid data