This is a very odd problem. I have a module that I want to package up as a service - it has a "Registry" class, with mainloop and stop methods (the former sits in an infinite loop, the latter signals the loop to terminate). I am trying to package this up as a simple service, as follows:
import win32serviceutil, win32service import registry class RegistryQueryService(win32serviceutil.ServiceFramework): _svc_name_ = "RegistryQueryService" _svc_display_name_ = "Oracle Registry Query Service" def __init__(self, args): win32serviceutil.ServiceFramework.__init__(self, args) def SvcStop(self): self.ReportServiceStatus(win32service.SERVICE_STOP_PENDING) self.reg.stop() def SvcDoRun(self): self.reg = registry.Registry() self.reg.mainloop() if __name__=='__main__': win32serviceutil.HandleCommandLine(RegistryQueryService) However, when I install and debug the service, and hit Ctrl-C to stop it, I get the error "Registry instance has no attribute 'stop'"!!! Here's a dump of the command output: D:\Data\RegQueries >service.py install Installing service RegistryQueryService to Python class D:\Data\RegQueries\servi ce.RegistryQueryService Service installed D:\Data\RegQueries >service.py debug Debugging service RegistryQueryService - press Ctrl+C to stop. Stopping debug service. Stopping debug service. Error 0xC000000B - The Python service control handler failed. File "C:\Apps\Python24\lib\site-packages\win32\lib\win32serviceutil.py", line 701, in ServiceCtrlHandler self.SvcStop() File "D:\Data\RegQueries\service.py", line 14, in SvcStop exceptions.AttributeError: Registry instance has no attribute 'stop' I'm baffled. I've added debug prints displaying my registry object, its dir(), the stop method, and they all look fine. Why can't SvcStop() find the method??? Thanks for any help. Paul. _______________________________________________ Python-win32 mailing list Python-win32@python.org http://mail.python.org/mailman/listinfo/python-win32