469,916 Members | 2,432 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,916 developers. It's quick & easy.

win32com short path name on 2k

Hi people,

Using win32com on 2k SP3...
import win32com.client as w32c
fc = w32c.Dispatch('Featurecam.Application')
fc.InstallPath u'C:\\PROGRA~1\\FEATUR~1'
Using win32com on XP Professional SP2... import win32com.client as w32c
fc = w32c.Dispatch('Featurecam.Application')
fc.InstallPath u'C:\\Program Files\\FeatureCAM'


Why the short vs long names?

--
bytecolor

Apr 26 '06 #1
4 1671
bytecolor wrote:
Hi people,

Using win32com on 2k SP3...
import win32com.client as w32c
fc = w32c.Dispatch('Featurecam.Application')
fc.InstallPath u'C:\\PROGRA~1\\FEATUR~1'

Using win32com on XP Professional SP2... import win32com.client as w32c
fc = w32c.Dispatch('Featurecam.Application')
fc.InstallPath

u'C:\\Program Files\\FeatureCAM'

Why the short vs long names?

That depends on how the com application was registered.

Thomas

Apr 26 '06 #2
I have no idea how Featurecam registers the type library. I did figure
out that I can get the full name 'C:\Program Files\Featurecam' from
within Featurecam using VBA and the same property I used in Pyhton ->
fc.InstallPath. Why would VBA and Python return two different strings?

This is really driving me nuts, because I know for a fact I was getting
the long name using python on 2k not 3 days ago, but now it's returning
the short name and I haven't changed/installed anything.

--
bytecolor

Apr 26 '06 #3
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.

Apr 26 '06 #4
Thanks Russell, those funcs sound familiar. I've probably used them or,
more than likely, read about them in the past.

--
bytecolor

Apr 26 '06 #5

This discussion thread is closed

Replies have been disabled for this discussion.

By using this site, you agree to our Privacy Policy and Terms of Use.