win32api.GetShortPathName : nt4.0 != win2k

Toni Arnold tonarn at localhost
Sat Sep 6 16:38:53 CEST 2003

I am using Zope 2.6.1 on win32 with integrated Python 2.1.3 and just discovered that

>>> win32api.GetShortPathName("C:/a long folder/a long file.txt")

behaves equally on nt4.0 and win2k: On both systems this error is raised if the file does not exist:

pywintypes.api_error: (2, 'GetShortPathName', 'Das System kann die angegebene Datei nicht finden.')

BUT (!): 

>>> win32api.GetShortPathName("C:/a long folder/file.txt")

behaves differently: On nt4.0 the file doesn't need to exist, probably because the name "file.txt" is already well formed according to the DOS 8+3 naming 
convention. On win2k, the same error as above is raised. 

This can break upwards compatibility of existing win32 Python/Zope applications using DOS helper applications, e.g. mine :-(

More information about the Python-list mailing list