py2exe failed for running compiled service

P

Peter Teniz

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?

thanks



my "setup.py" script:
from distutils.core import setup
import py2exe
import sys

if len(sys.argv) < 2:
sys.argv.append ( "py2exe" )
sys.argv.append ( "--verbose" )
sys.argv.append ( "--packages" )
sys.argv.append ( "encodings" )
#sys.argv.append ( "-q" ) # be quiet

class Target:
def __init__ (self, **kw):
self.__dict__.update ( kw )

# for versioninfo resources
self.version = "0.9.0"

FBserver = Target (
description = "firebird backend server",
script = "FBxmlserv.py",
)

FBservice = Target (
description = "firebird windows nt service",
modules = ["FBservice"],
)

excludes = [ "pywin.debugger.dbgcon", "pywin.dialogs", "pywin.dialogs.list" ]

setup (
options = { "py2exe" : {
"compressed" : 1,
"optimize" : 2,
"excludes" : excludes
}
},
zipfile = "lib/shared.zip",
service = [FBservice],
console = [FBserver],
)
 
T

Thomas Heller

Peter Teniz said:
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

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,770
Messages
2,569,583
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top