Bug Report + Fix: os.path.normpath
Andrew Cooke
andrew at andrewcooke.free-online.co.uk
Mon Oct 11 12:31:48 EDT 1999
Hi,
On NT using 1.5.2 I see the following:
import os.path
print os.path.normpath(r'.\\a\b')
\a\b
which looks wrong (I expect a\b, which is the output for r'.\a\b')
To fix this, change:
elif comps[i] == '' and i > 0 and comps[i-1] <> '':
del comps[i]
to
elif comps[i] == '':
del comps[i]
within normpath in Libs\ntpath.py (it's obvious where once you look at
the routine)
I can't work out what the check is for in the old version, as the
modified code seems to work OK for all cases I can think of - but I'm
worried it is there for a reason.
The same code appears in posixpath and so the same error will be seen on
Unix.
Cheers,
Andrew
http://www.andrewcooke.free-online.co.uk/index.html
Sent via Deja.com http://www.deja.com/
Before you buy.
More information about the Python-list
mailing list