[python-win32] Querying the VNC Service fails sometimes

Mike Driscoll mdriscoll at co.marshall.ia.us
Tue Jun 24 16:19:03 CEST 2008


Kevin,

> Also check the permissions on the problem users registry.  I would 
> expect that to cause a different error, but it might be worth checking.

Most users are local admins. And it's just been happening for the last 
couple of weeks, so it's likely what Roger said: a corrupt registry 
entry. I tried upgrading to 211 last night and am waiting for that user 
to login again. For some reason, after upgrading to 211, I am getting an 
import error on my wx module. Are these tied together in some weird way?

>
> Kevin Horn
>
> On Mon, Jun 23, 2008 at 2:25 PM, Roger Upole <rwupole at msn.com 
> <mailto:rwupole at msn.com>> wrote:
>
>
>     Mike Driscoll wrote:
>
>         Mike Driscoll wrote:
>
>             Hi,
>
>             In one of my login scripts for work, I run a query to see
>             if the VNC
>             service is running using the win32serviceutil module. The
>             code for
>             that I am using looks something like this:
>
>             <code>
>             import win32serviceutil
>             serviceState = win32serviceutil.QueryServiceStatus('VNC
>             Server')[1]
>             </code>
>
>             This works in 99.99% of cases. However, I have on user
>             that keeps
>             getting the following traceback:
>
>             Traceback (most recent call last):
>              File "\\ourServer\pathName\PostLogon.py", line 207, in ?
>               serviceState = win32serviceutil.QueryServiceStatus('VNC
>             Server')[1]
>              File
>             "\\ourServer\pathName\Python24\lib\site-packages\win32\lib\win32serviceutil.py",
>             line 479, in QueryServiceStatus
>               hs = SmartOpenService(hscm, serviceName,
>             win32service.SERVICE_QUERY_STATUS)
>              File
>             "\\ourServer\pathName\Python24\lib\site-packages\win32\lib\win32serviceutil.py",
>             line 81, in SmartOpenService
>               name = _GetServiceShortName(name)
>              File
>             "\\ourServer\pathName\Python24\lib\site-packages\win32\lib\win32serviceutil.py",
>             line 62, in _GetServiceShortName
>               skey = win32api.RegOpenKey(hkey, svc, 0, access)
>             error: (2, 'RegOpenKeyEx', 'The system cannot find the
>             file specified.')
>
>
>             <snip>
>
>
>
>         I forgot to mention that we use Windows XP, Python 2.4 and PyWin32
>         version 210.
>
>         Mike
>
>
>     You might want to try build 211.  It uses the API function
>     GetServiceKeyName instead of manually enumerating the
>     registry.
>
>     However, it sounds like you could have a corrupt registry key.
>     Try reinstalling the service and see if that helps.
>
>            Roger
>

Mike


More information about the python-win32 mailing list