Serhiy Storchaka added the comment: Here is a patch which fixes this issue (and related issues).
* Encoding declaration now detected in second line only if first line is spaces-only (this is needed for support -x option) or comment-only (needed for she-bang). * Fixed support for -x option. * PyTokenizer_FromString() no longer check encoding declaration in second line if it was found in first line. * Fixed encoding detection in the tokenize module, in IDLE, in 2to3 and in the findnocoding script. ---------- assignee: -> serhiy.storchaka keywords: +patch stage: -> patch review Added file: http://bugs.python.org/file33304/source_encoding_second_line.patch _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue18960> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com