[New-bugs-announce] [issue7315] os.path.normpath doesn't normalize ../path/something.py

James report at bugs.python.org
Fri Nov 13 18:05:15 CET 2009

New submission from James <purpleidea at gmail.com>:

os.path.normpath doesn't normalize paths that start with ../
you would expect the final output line in the secpnd run to read:
"normpath: badnormpath.py" instead of: "normpath: ../tmp/badnormpath.py"


james at home:~$ cd tmp/
james at home:~/tmp$ cat badnormpath.py 

import os.path

print '__file__: %s' % __file__
print 'normpath: %s' % os.path.normpath(__file__)

james at home:~/tmp$ ./badnormpath.py 
__file__: ./badnormpath.py
normpath: badnormpath.py
james at home:~/tmp$ ./../tmp/badnormpath.py 
__file__: ./../tmp/badnormpath.py
normpath: ../tmp/badnormpath.py
james at home:~/tmp$

components: Library (Lib)
messages: 95189
nosy: purpleidea
severity: normal
status: open
title: os.path.normpath doesn't normalize ../path/something.py
type: behavior
versions: Python 2.6, Python 2.7, Python 3.0

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list