[python-win32] Problem with service start type "auto"

Boris Perez Canedo inf200523 at ucf.edu.cu
Wed May 19 15:36:15 CEST 2010



Hi everybody.

I'm new in the list and I'm not an english speaking
person. If you see a lot of mistakes please excuse me I'm trying my
best.

I have a compiled python service which I can install, remove,
start and stop without errors (manually). The problem ocurrs when I change the
start type and set it to "auto". Then I restart my computer to see if the
service starts correctly. I see two errors informed by the service control manager:

1)Timeout (30000 ms.) for connection to WBEM Inv service.

And right after that.

2)The service did not responde to the start or
control request in a timely fashion.

If I go and perform an explicit start,
keeping the start type in auto, the service starts and no errors are informed.

I don't understand why the operating system can not start the service by itself.

This is the output for "sc interrogate" on my service in case it
helps:

SERVICE_NAME: WBEMInv
       
TYPE              
: 10  WIN32_OWN_PROCESS
       
STATE              :
4  RUNNING
                               
(STOPPABLE,NOT_PAUSABLE,IGNORES_SHUTDOWN)
        WIN32_EXIT_CODE    : 0 
(0x0)
        SERVICE_EXIT_CODE  : 0 
(0x0)
       
CHECKPOINT         : 0x0
       
WAIT_HINT          : 0x0


My python code:

import win32serviceutil
import win32service
import win32event
import servicemanager
import os

def
system():
     # my system implementation.

class
XmlRPCService(win32serviceutil.ServiceFramework):
    _svc_name_ =
'WBEMInv'
    _svc_display_name_ = "WBEM Inventory"
    _svc_description_ = 'Servicio xml rpc para realizar inventario de
ordenadores conectados a redes hibridas'
    def __init__(self,
args):
         key =
_winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE,"SOFTWARE\\UCf\\WBEMInv\\Settings")
         path = _winreg.EnumValue(key,
0)[1]
         os.chdir(path) # I dont
want the working directory to be system32.
          _winreg.CloseKey(key)
        
win32serviceutil.ServiceFramework.__init__(self, args)
        self.hWaitStop =
win32event.CreateEvent(None, 0, 0, None)
    def SvcStop(self):
       
self.ReportServiceStatus(win32service.SERVICE_STOP_PENDING)
        sys.stopservice = "true"
        win32event.SetEvent(self.hWaitStop)
    def SvcDoRun(self):
       
system()
    
if __name__=='__main__':
     win32serviceutil.HandleCommandLine(XmlRPCService)

Thank you very much.

Boris.


---
Convencion Internacional de Psicologia y Ciencias Sociales y Humanas
Cienfuegos, Cuba, del 19 al 22 de abril del 2011
http://promociondeeventos.sld.cu/hominis2011
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-win32/attachments/20100519/232ce77a/attachment.html>


More information about the python-win32 mailing list