[issue10603] __file__ not usable, with certain paths on windows XP.

Campbell Barton report at bugs.python.org
Thu Dec 2 12:16:41 CET 2010


New submission from Campbell Barton <ideasman42 at gmail.com>:

# 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.

----------
components: Interpreter Core
messages: 123063
nosy: ideasman42
priority: normal
severity: normal
status: open
title: __file__ not usable, with certain paths on windows XP.
type: behavior
versions: Python 3.1

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue10603>
_______________________________________


More information about the Python-bugs-list mailing list