[New-bugs-announce] [issue19941] python -m imports non-ASCII .py file without encoding declaration
Jakub Wilk
report at bugs.python.org
Tue Dec 10 12:04:57 CET 2013
New submission from Jakub Wilk:
If you have a non-ASCII .py file without encoding declaration, then you can't normally import it:
$ python --version
Python 2.7.6
$ python -c 'import test'
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "test.py", line 1
SyntaxError: Non-ASCII character '\xc2' in file test.py on line 1, but no encoding declared; see http://www.python.org/peps/pep-0263.html for details
However, "python -m" happily imports such files:
$ python -m test
¡Hello world!
----------
files: test.py
messages: 205787
nosy: jwilk
priority: normal
severity: normal
status: open
title: python -m imports non-ASCII .py file without encoding declaration
versions: Python 2.7
Added file: http://bugs.python.org/file33076/test.py
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue19941>
_______________________________________
More information about the New-bugs-announce
mailing list