This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: "SyntaxError: None" when the name of the dir contains non-ascii chars
Type: behavior Stage:
Components: Unicode Versions: Python 3.0
process
Status: closed Resolution: out of date
Dependencies: Superseder:
Assigned To: Nosy List: ezio.melotti, ocean-city
Priority: normal Keywords:

Created on 2009-02-20 05:17 by ezio.melotti, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (4)
msg82513 - (view) Author: Ezio Melotti (ezio.melotti) * (Python committer) Date: 2009-02-20 05:17
Step to reproduce:
1) create a directory with non-ascii chars in the name
2) create a python module with a syntax error (I used an unclosed '(')
3) execute the module.py directly ('module.py', not 'python module.py')

I tested this only on Windows, with Python3 as the default interpreter
used to execute *.py files, this is the output:

# ascii dir, works fine
D:\>module1.py
  File "D:\module1.py", line 21
                       ^
SyntaxError: invalid syntax
# moving to non-ascii dir
D:\>cd äåæ
# non ascii-dir, fails
D:\äåæ>module1.py
SyntaxError: None
# here is using py2.6, but with 'python module1.py' it doesn't print the
dir name
D:\äåæ>python module1.py
  File "module1.py", line 21
                       ^
SyntaxError: invalid syntax
# same as before but with py3
D:\äåæ>python3 module1.py
  File "module1.py", line 21
                       ^
SyntaxError: invalid syntax

# with print(sys.version) in module1.py
D:\äåæ>module1.py
3.0 (r30:67507, Dec  3 2008, 20:14:27) [MSC v.1500 32 bit (Intel)]
D:\äåæ>python module1.py
2.6 (r26:66721, Oct  2 2008, 11:35:03) [MSC v.1500 32 bit (Intel)]
D:\äåæ>python3 module1.py
3.0 (r30:67507, Dec  3 2008, 20:14:27) [MSC v.1500 32 bit (Intel)]

This seems to happen only with SyntaxErrors, I tested a couple of other
errors and it seems to work:

# with print(sys.version) and 5/0 in module1
# here it prints the dir name without problems (but it doesn't show '5/0')
D:\äåæ>module1.py
3.0 (r30:67507, Dec  3 2008, 20:14:27) [MSC v.1500 32 bit (Intel)]
Traceback (most recent call last):
  File "D:\äåæ\module1.py", line 3, in <module>
ZeroDivisionError: int division or modulo by zero

D:\äåæ>python module1.py
2.6 (r26:66721, Oct  2 2008, 11:35:03) [MSC v.1500 32 bit (Intel)]
Traceback (most recent call last):
  File "module1.py", line 3, in <module>
    5/0
ZeroDivisionError: integer division or modulo by zero

D:\äåæ>python3 module1.py
3.0 (r30:67507, Dec  3 2008, 20:14:27) [MSC v.1500 32 bit (Intel)]
Traceback (most recent call last):
  File "module1.py", line 3, in <module>
    5/0
ZeroDivisionError: int division or modulo by zero
msg82524 - (view) Author: Hirokazu Yamamoto (ocean-city) * (Python committer) Date: 2009-02-20 09:48
Can you try this with 3.0.1?
http://python.org/download/releases/3.0.1
msg82525 - (view) Author: Ezio Melotti (ezio.melotti) * (Python committer) Date: 2009-02-20 10:09
With 3.0.1 it seems to work fine.
msg82526 - (view) Author: Hirokazu Yamamoto (ocean-city) * (Python committer) Date: 2009-02-20 10:20
Thanks, I'll close this entry.
History
Date User Action Args
2022-04-11 14:56:45adminsetgithub: 49575
2009-02-20 10:20:54ocean-citysetstatus: open -> closed
resolution: out of date
messages: + msg82526
2009-02-20 10:09:09ezio.melottisetmessages: + msg82525
2009-02-20 09:48:09ocean-citysetnosy: + ocean-city
messages: + msg82524
2009-02-20 05:17:12ezio.melotticreate