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: __file__ not usable, with certain paths on windows XP.
Type: behavior Stage: resolved
Components: Interpreter Core Versions: Python 3.1
process
Status: closed Resolution: out of date
Dependencies: Superseder:
Assigned To: Nosy List: ideasman42, r.david.murray, vstinner
Priority: normal Keywords:

Created on 2010-12-02 11:16 by ideasman42, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Messages (4)
msg123063 - (view) Author: Campbell Barton (ideasman42) * Date: 2010-12-02 11:16
# create this path.
# it could be made by any application but including this line
# so encoding is not confused.
# c:\äöü
__import__("os").mkdir(b'c:\\\xe4\xf6\xfc')

# Now create a new script and save in the newly created dir
c:\äöü\test.py

# In c:\äöü\test.py add the following line
__import__("os").listdir(os.path.dirname(__file__))


# Now run the script from the command line using its absolute path.
c:\Python31\python.exe c:\äöü\test.py

--- This gives an error.
Traceback (most recent call last):
  File "m:\\xc3\xa4\xc3\xb6\xc3¼\test.py", line 2, in <module>
WindowsError: [Error 3] The system cannot find the path specified: 'm:\\\xc3\xa4\xc3\xb6\xc3¼\\*.*'


This is a bug because a script should be able to inspect the path where it is located.
msg123074 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2010-12-02 14:14
Much work has been done on non-ASCII paths in 3.2.  Can you test this with the 3.2 alpha and let us know the results?
msg123107 - (view) Author: Campbell Barton (ideasman42) * Date: 2010-12-02 19:56
This is fixed in 3.2a4.
msg123126 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2010-12-02 21:55
Great!
History
Date User Action Args
2022-04-11 14:57:09adminsetgithub: 54812
2010-12-02 21:55:37vstinnersetmessages: + msg123126
2010-12-02 19:59:58r.david.murraysetstatus: open -> closed
resolution: out of date
stage: resolved
2010-12-02 19:56:01ideasman42setmessages: + msg123107
2010-12-02 14:14:22r.david.murraysetnosy: + r.david.murray
messages: + msg123074
2010-12-02 14:13:13r.david.murraysetnosy: + vstinner
2010-12-02 11:16:39ideasman42create