[python-win32] winshell error

Tim Golden mail at timgolden.me.uk
Thu Jan 24 17:23:47 CET 2008


Mike Driscoll wrote:
> I have a Python login script that runs various things on login for the
> users in our Windows domain. Every once in a while, I'll get a traceback
> when I use winshell to try to find the user's desktop. The offending code
> is:
> 
> userDesktop = winshell.desktop()
> 
> And the traceback:
> 
> File "\\servername\logon\MCISpy.py", line 256, in ?
>     import SoScripts
>   File "\\servername\logon\PythonPackages\Utilities\SoScripts.py", line
> 42, in ?
>     userDesktop = winshell.desktop()
>   File "\\servername\logon\Python24\lib\site-packages\winshell.py", line
> 48, in desktop
>     return get_path ((shellcon.CSIDL_DESKTOP,
> shellcon.CSIDL_COMMON_DESKTOPDIRECTORY)[common])
>   File "\\servername\logon\Python24\lib\site-packages\winshell.py", line
> 44, in get_path
>     return shell.SHGetPathFromIDList (shell.SHGetSpecialFolderLocation (0,
> folder_id))
> com_error: (-2147467259, 'Unspecified error', None, None)
> 
> 
> Our login scripts have an error reporting module that emails the
> tracebacks to us when they occur. Since this doesn't happen every time the
> user logs in, it is difficult to track down. Does anyone know what this is
> and how to fix it?

Doing things in login scripts is, unfortunately, a recipe for
sporadic issues of this sort. I don't know if it's documented
(and I haven't actually looked too hard) but the interaction
between the Windows Shell's own startup activities and a
domain-level logon script seems to be ill-defined.

I hope that someone reading this has more recent experience
(and more knowledge) than I do re login scripts, but when I
was responsible for a several-thousand-line Kixtart login
script, we found that we just had to throw in random delays
-- perhaps, here, catching the exception and trying again after
delay -- because the login script had somehow got ahead of the
desktop / profile setup.

TJG


More information about the python-win32 mailing list