py2exe failed for running compiled service

Thomas Heller theller at python.net
Wed Feb 11 13:05:58 EST 2004


Peter Teniz <peter.teniz at inverisa.net> writes:

> hi, i'm trying to generate a service for win XP / win 2k with
> python2.3.3 + win32all-163 + py2exe0.5.0
> (also tried with pywin32-200.win32-py2.3)
>
> running the console-script "FBxmlserv.py" with python-interpreter and as
> EXE-prog goes well.
> running the service-module "FBservice.py" with python-interpreter also
> works fine
> but after comiling with py2exe (with no warnings or errors!)  i get on
> every host the same error message
> when trying to execute the FBservice.exe
>
>  > FBservice.exe
> Connecting to the Service Control Manager
> Traceback (most recent call last):
>     File "boot_service.py" line 158, in ?
> pywintypes.error: (1063, 'StartServiceCtrlDispatcher', 'Der
> Dienstprozess konnte keine Verbindung zum Dienstcontroller herstellen.')
>
> has anyone an idee, what to do?

This is not a bug.

Services are supposed to be started by the system - the windows service
control manager.  They have to be registered before, and the exe accepts
some command line switches that help with this.

You can run the service exe with the '-help' command line switch to list
them:

C:\Python23\Lib\site-packages\py2exe\samples\advanced\dist>MyService.exe -help
Usage: MyService.exe <options>. Valid options are:
        -help
        -install
        -remove
        -auto
        -disabled
        -interactive
        -user: <arg>
        -password: <arg>

C:\Python23\Lib\site-packages\py2exe\samples\advanced\dist>

So, first you install your service exe with this command line:

'MyService.exe -install'

The other switches -auto, -disabled, -interactive, -user and -password
allow to specify additional service options.

After that, the service can be started with 'net start myservice' or
with the services applet in the control panel.

Thomas

PS: If this seems not appropriate, it can be changed by hacking the
py2exe/boot_service.py script.



More information about the Python-list mailing list