[python-win32] Python Service error 1053: the service did not respond to the start or control request in a timely fashion
Richard Zinn
ricozinn at gmail.com
Sat Jan 17 02:35:50 CET 2009
Hi, I've implemented the MyService.py example from the py2exe samples
directory using Python2.6, on my Windows XP SP2, and I get the error
1052...did not respond in a timely fashion immediately when I run the
MyService.py, or the MyService.exe, or if I install it as a service using an
NSIS installer script I wrote, and start it using the windows service
manager.
Any ideas? Here is the code reduced to just the essentials:
import win32serviceutil
import win32service
import win32event
import win32evtlogutil
class MyService(win32serviceutil.ServiceFramework):
_svc_name_ = "MyService"
_svc_display_name_ = "My Service"
_svc_deps_ = ["EventLog"]
def __init__(self, args):
win32serviceutil.ServiceFramework.__init__(self, args)
self.hWaitStop = win32event.CreateEvent(None, 0, 0, None)
def SvcStop(self):
self.ReportServiceStatus(win32service.SERVICE_STOP_PENDING)
win32event.SetEvent(self.hWaitStop)
def SvcDoRun(self):
import servicemanager
log("running")
win32event.WaitForSingleObject(self.hWaitStop, win32event.INFINITE)
log("stopped")
if __name__ == '__main__':
win32serviceutil.HandleCommandLine(MyService)
I've seen other posters with similar problems, but with theirs it doesn't
work in the .exe, but in my case it doesn't work when I run the .py either.
The traceback in python says:
> python MyService.py
Collecting Python Trace Output...
Traceback (most recent call last):
File "C:\Python26\Lib\site-packages\win32\lib\win32serviceutil.py", line
399,
in StartService
win32service.StartService(hs, args)
pywintypes.error: (1053, 'StartService', 'The service did not respond to the
sta
rt or control request in a timely fashion.')
Thanks in advance,
Richard
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-win32/attachments/20090116/eb49fa96/attachment.htm>
More information about the python-win32
mailing list