Message247988
| Author |
Drekin |
| Recipients |
Arfrever, Drekin, eric.snow, georg.brandl, larry, ncoghlan, serhiy.storchaka |
| Date |
2015年08月04日.12:20:07 |
| SpamBayes Score |
-1.0 |
| Marked as misclassified |
Yes |
| Message-id |
<1438690807.88.0.130669510777.issue19518@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
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. |
|