I have a Windows service that I distribute in "compiled" form, using py2exe.  This has been working well, but I recently ran into a problem.  It works when starting from source, but the py2exe-built executable fails on startup with the message "Error starting service: The service did not respond to the start or control request in a timely fashion."  This message comes up immediately, so it's pretty clearly not time-related.

I've been digging into the win32serviceutil code, and I've found a clue: if I start the service in debug mode, it works without a problem.  This seems to be related to the fact that the service class I pass to HandleCommandLine is only instantiated by the DebugService method.  StartService never instantiates it, only using it to get the _svc_* attributes.  So, the ServiceFramework.__init__ method never gets called, and that's where it registers itself to the service manager.

For what it's worth, I've been using this service for quite a while, developing it on an old Win XP machine.  The trouble started when I moved over to a new Win 7 Professional system.  Have there been some changes in py2exe or pywin32 that might relate to this?

Thanks for any good words,

Don Dwiggins
Advanced Publishing Technology