Using py2exe to wrap a service?
Maria.Reinhammar at accalon.com
Maria.Reinhammar at accalon.com
Wed Sep 20 08:42:19 EDT 2006
I have an app using active_directory.py and the std module asyncore in
a Windows Service.
Works perfectly!
That is, until I try to use py2exe to create a standalone (need to
avoid installing the entire Python etc. on the target system).
When I try to start the installed Service, the system tells me it
terminates prematurely
and in the event log I find:
The instance's SvcRun() method failed
File "win32serviceutil.pyc", line 785, in SvcRun
File "XXProxySvc.pyc", line 126, in SvcDoRun
File "XXProxySvc.pyc", line 94, in setup
File "D:\projects\XXProxy\DB.py", line 54, in loadFromAD
File "active_directory.pyc", line 402, in search
File "active_directory.pyc", line 398, in root
File "active_directory.pyc", line 371, in AD
File "active_directory.pyc", line 378, in _root
File "win32com\client\__init__.pyc", line 73, in GetObject
File "win32com\client\__init__.pyc", line 88, in Moniker
pywintypes.com_error: (-2147221020, 'Invalid syntax', None, None)
The offending line is:
import active_directory as AD
...
for item in AD.search ("objectCategory='Person'"):
...
I.e. the call to AD.search() is the entry point to the problem.
The setup.py is (pretty straight forward..):
from distutils.core import setup
import py2exe
class Target:
def __init__(self, **kw):
self.__dict__.update(kw)
# for the versioninfo resources
self.version = "0.9.0"
self.company_name = "My Company"
self.copyright = "My Company (c)"
self.name = "FilterProxy"
################################################################
# a NT service, modules is required
myservice = Target(
# used for the versioninfo resource
description = "AD Driven Mail Filter",
# what to build. For a service, the module name (not the
# filename) must be specified!
modules = ["ProxySvc"]
)
excludes = []
setup(options = {"py2exe": {# create a compressed zip archive
#"compressed": 1,
#"optimize": 2,
"excludes": excludes
}
},
service=[myservice]
)
'elp! Pleeeez!
More information about the Python-list
mailing list