win32com short path name on 2k

Russell Warren russandheather at gmail.com
Wed Apr 26 15:12:19 EDT 2006


I've been driven crazy by this type of thing in the past.  In my case
it was with the same application (not two like you), but on different
machines, with all supposedly having the same OS load.  In some cases I
would get short path names and in others I would get long path names.
I could never figure it out any logical explanation for the behaviour
so I just worked around it (*cough* hack *cough*).

To help you generally get around it, you may not know about these two
functions (both in kernel32)...

GetShortPathName - http://tinyurl.com/nxzkl
GetLongPathName - http://tinyurl.com/r4ey4

You can work out a scheme with these where it doesn't matter what mood
Windows is in when you ask it for a path.

In my case I had another big problem, and that was that it would also
arbitrarily decide to change the case of critical paths.. eg:
"C:\Windows" on one machine, and "C:\windows" on another.  That also
drove me bonkers and resulted in some lost years/hair.




More information about the Python-list mailing list