[python-win32] Running a Windows Python service without pythonservice.exe?

Mark Hammond skippy.hammond at gmail.com
Thu May 13 00:55:23 CEST 2010


On 13/05/2010 2:08 AM, Bill Janssen wrote:
> Bill Janssen<janssen at parc.com>  wrote:
>
>> $ python nativePipeTestService.py start
>> Starting service PyNativePipeTestService []
>> Error starting service: The service did not respond to the start or control request in a timely fashion.
>> $
>
> I rebooted and tried again, same result.
>
> Then I tried setting up a win32trace window first, and ran
>
> $ python nativePipeTestService.py
> Redirecting output to win32trace remote collector
> $
>
> What shows up in the trace window is this:
>
>> C:\UpLib\1.7.9\python\Lib\site-packages\win32\lib>python win32traceutil.py
> Collecting Python Trace Output...
> service is starting...
> (execute this script with '--help' if that isn't what you want)
> Something went bad!
> Traceback (most recent call last):
>    File "nativePipeTestService.py", line 51, in<module>
>      main()
>    File "nativePipeTestService.py", line 44, in main
>      servicemanager.StartServiceCtrlDispatcher()
> error: (1063, 'StartServiceCtrlDispatcher', 'The service process could not connect to the service controller.')
>
> This smacks of a registry problem, but I'm unsure where to go from here...

When run with no args, the program assumes it is being started as the 
service - see the first 3 output lines.

Execute 'python nativePipeTestService.py install' to install it, then 
start it as normal (ie, don't run it manually with no args).  If you 
want different cmdline behaviour, the script can be re-worked to catch 
the error calling StartServiceCtrlDispatcher(), assume the user is 
running it interactively and take some different action.

Mark


More information about the python-win32 mailing list