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: WIN32 os.path.normpath('./') incorrect
Type: Stage:
Components: Library (Lib) Versions:
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: doerwalter, gmcm, mshomphe, stevenknight
Priority: normal Keywords:

Created on 2002-01-31 16:22 by stevenknight, last changed 2022-04-10 16:04 by admin. This issue is now closed.

Messages (4)
msg9072 - (view) Author: Steven Knight (stevenknight) Date: 2002-01-31 16:22
os.path.normpath() on WIN32 systems returns a null 
string for . followed by a directory separator:

>>> os.path.normpath('./')
''
>>> os.path.normpath('.\\')
''
>>> os.path.normpath('.')
'.'
>>>

Contrast with what happens on Linux:

>>> os.path.normpath('./')
'.'
>>> os.path.normpath('.')
'.'
>>>

Sorry, I don't have a later version than 2.1.1 
available to check whether this is fixed in a later 
version, but I did do a search for other reports of 
this bug and found none.

    --SK


msg9073 - (view) Author: Gordon B. McMillan (gmcm) Date: 2002-03-07 15:36
Logged In: YES 
user_id=4923

Python 2.2 (#28, Dec 21 2001, 12:21:22) [MSC 32 bit 
(Intel)] on win32
>>> os.path.normpath('./')
'.'
>>> os.path.normpath('.\\')
'.'
>>> os.path.normpath('.')
'.'
>>>
msg9074 - (view) Author: Matthew Shomphe (mshomphe) Date: 2003-06-04 17:42
Logged In: YES 
user_id=716326

This appears to be fixed in 2.3b1:

Python 2.3b1 (#40, Apr 25 2003, 19:06:24) [MSC v.1200 32 
bit (Intel)] on win32
Type "copyright", "credits" or "license" for more information.
IDLE 0.8 -- press F1 for help
>>> import os
>>> os.path.normpath('./')
'.'
>>> os.path.normpath('.\\')
'.'
>>> os.path.normpath('.')
'.'
msg9075 - (view) Author: Walter Dörwald (doerwalter) * (Python committer) Date: 2003-06-16 18:39
Logged In: YES 
user_id=89016

It seems that this has been fixed in ntpath.py rev 1.41:
$ cvs up -r 1.41 Lib/ntpath.py
P Lib/ntpath.py
$ ./pcbuild/python
Python 2.3b1+ (#40, Jun 16 2003, 18:55:59) [MSC v.1200 32
bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more
information.
>>> import ntpath
>>> ntpath.normpath(".")
'.'
>>> ntpath.normpath("./")
'.'
>>> ntpath.normpath(".\\")
'.'
>>>

$ cvs up -r 1.40 Lib/ntpath.py
P Lib/ntpath.py
$ ./pcbuild/python
Python 2.3b1+ (#40, Jun 16 2003, 18:55:59) [MSC v.1200 32
bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more
information.
>>> import ntpath
>>> ntpath.normpath(".")
'.'
>>> ntpath.normpath("./")
''
>>> ntpath.normpath(".\\")
''

rev 1.41 was part of Python 2.2, so I think we can close
this bug.
History
Date User Action Args
2022-04-10 16:04:56adminsetgithub: 36008
2002-01-31 16:22:22stevenknightcreate