Adam Bartoš added the comment:
I'm not sure this is the right issue. The support for Unicode filenames is not
(at least on Windows) ideal.
Let α.py be a Python script with invalid syntax.
> py α.py
File "<encoding error>", line 2
as as compile error
^
SyntaxError: invalid syntax
On the other hand, if run.py is does something like
path = sys.argv[1]
with tokenize.open(path) as f:
source = f.read()
code = compile(source, path, "exec")
exec(code, __main__.__dict__)
we get
> py run.py α.py
File "Python Unicode\\u03b1.py", line 2
as as compile error
^
SyntaxError: invalid syntax
(or 'File "Python Unicode\α.py", line 2' depending on whether sys.stdout can
encode the string).
So the "<encoding error>" in the first example is unfortunate as it is easy to
get better result even by a simple pure Python approach.
----------
nosy: +Drekin
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue19518>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com