New submission from Paul Bonser: 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: coding=0 A simple fix would be to check that the line is a comment before trying to look up the encoding from that line. ---------- components: 2to3 (2.x to 3.x conversion tool) messages: 196435 nosy: Paul.Bonser priority: normal severity: normal status: open title: "Encoding" detected in non-comment lines type: crash versions: Python 2.7, Python 3.1, Python 3.2, Python 3.3 _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue18873> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com