This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Paul.Bonser
Recipients Paul.Bonser
Date 2013-08-28.23:50:28
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
lib2to3.pgen2.tokenize:detect_encoding looks for the regex "coding[:=]\s*([-\w.]+)" in the first two lines of the file without first checking if they are comment lines.

You can get 2to3 to fail with "SyntaxError: unknown encoding: 0" with a single line file:


A simple fix would be to check that the line is a comment before trying to look up the encoding from that line.
Date User Action Args
2013-08-28 23:50:28Paul.Bonsersetrecipients: + Paul.Bonser
2013-08-28 23:50:28Paul.Bonsersetmessageid: <>
2013-08-28 23:50:28Paul.Bonserlinkissue18873 messages
2013-08-28 23:50:28Paul.Bonsercreate