[python-win32] Winshell issues

Mike Driscoll mdriscoll at co.marshall.ia.us
Wed Aug 12 20:50:25 CEST 2009


Michael M Mason wrote:
>> Hi,
>>
>> I've been using Tim Golden's winshell module for a couple of years and
>>     
>
>   
>> just in the last week or so, I've been receiving the following error 
>> from multiple users:
>>
>> Traceback (most recent call last):
>>   File "\\debianso\loginscript$\MCISpy.py", line 267, in ?
>>     import SoScripts
>>   File
>>     
> "\\debianso\loginscript$\PythonPackages\Utilities\SoScripts.py", line
> 49, in ?
>   
>>     program_files =inshell.programs()     
>>   File
>>     
> "\\Debianis\loginscript$\Python24\lib\site-packages\winshell.py", line
> 71, in programs
>   
>>     return get_path ((shellcon.CSIDL_PROGRAMS,
>>     
> shellcon.CSIDL_COMMON_PROGRAMS)[common])
>   
>>   File
>>     
> "\\Debianis\loginscript$\Python24\lib\site-packages\winshell.py", line
> 44, in get_path
>   
>>     return shell.SHGetPathFromIDList (shell.SHGetSpecialFolderLocation
>>     
> (0, folder_id))
>   
>>     com_error: (-2147024893, 'The system cannot find the path
>>     
> specified.', None, None)
>
> Does it work any better if you try this (in the Python Shell):-
>
>   
>>>> from win32com.shell import shell, shellcon
>>>> shell.SHGetFolderPath (0, shellcon.CSIDL_COMMON_PROGRAMS, None, 0)
>>>>         
>
> I'm using Python 3 so I had to mess about to get winshell.py to work.
> I've also found that the results returned from winshell are byte arrays
> whereas the results returned from the example above are strings.  I
> don't know whether that matters in Python 2.4, but it matters in Python
> 3.
>
> I have no idea at all why you should suddenly have a problem if it was
> working before.
>
>   

Well, I haven't figured it out either. One of my colleagues suggested 
that maybe a MS update broke something, which is possible I suppose. 
They've been releasing a lot of updates lately. For the time being, I've 
wrapped it in a try/except and am creating the path in a more convoluted 
fashion if it fails. Not ideal, but it works. Hopefully Golden will have 
an idea.


- Mike


More information about the python-win32 mailing list