[New-bugs-announce] [issue2660] 2to3 throws a utf8 decode error on a iso-8859-1 string

Brandon Ehle report at bugs.python.org
Sat Apr 19 23:05:02 CEST 2008

New submission from Brandon Ehle <azverkan at gmail.com>:

While running the 2to3 script on the scons codebase, I ran into an

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 <module>
  File "/usr/local/lib/python3.0/lib2to3/refactor.py", line 81, in main
  File "/usr/local/lib/python3.0/lib2to3/refactor.py", line 188, in
  File "/usr/local/lib/python3.0/lib2to3/refactor.py", line 217, in
    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

assignee: collinwinter
components: 2to3 (2.x to 3.0 conversion tool)
files: 2to3bug.py
messages: 65637
nosy: azverkan, collinwinter
severity: normal
status: open
title: 2to3 throws a utf8 decode error on a iso-8859-1 string
versions: Python 3.0
Added file: http://bugs.python.org/file10063/2to3bug.py

Tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list