2to3 chokes on bad character

Frank Millman frank at chagford.com
Thu Feb 24 08:19:04 EST 2011

"Peter Otten" <__peter__ at web.de> wrote
> John Machin wrote:
>> Your Python 2.x code should be TESTED before you poke 2to3 at it. In
>> this case just trying to run or import the offending code file would
>> have given an informative syntax error (you have declared the .py file
>> to be encoded in UTF-8 but it's not).
> The problem is that Python 2.x accepts arbitrary bytes in string 
> constants.
> No error message or warning:

Thanks, Peter. I saw this after I replied to John, so this somewhat 
invalidates my reply.

However, John's principle still holds true, and that is the main lesson I 
have taken away from this.


More information about the Python-list mailing list