473,839 Members | 1,484 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Using py2exe to wrap a service?

I have an app using active_director y.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 "win32serviceut il.pyc", line 785, in SvcRun
File "XXProxySvc.pyc ", line 126, in SvcDoRun
File "XXProxySvc.pyc ", line 94, in setup
File "D:\projects\XX Proxy\DB.py", line 54, in loadFromAD
File "active_directo ry.pyc", line 402, in search
File "active_directo ry.pyc", line 398, in root
File "active_directo ry.pyc", line 371, in AD
File "active_directo ry.pyc", line 378, in _root
File "win32com\clien t\__init__.pyc" , line 73, in GetObject
File "win32com\clien t\__init__.pyc" , line 88, in Moniker
pywintypes.com_ error: (-2147221020, 'Invalid syntax', None, None)

The offending line is:
import active_director y as AD
....
for item in AD.search ("objectCategor y='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__.u pdate(kw)
# for the versioninfo resources
self.version = "0.9.0"
self.company_na me = "My Company"
self.copyright = "My Company (c)"
self.name = "FilterProx y"

############### ############### ############### ############### ####
# 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!

Sep 20 '06 #1
2 4150
Ma************* *@accalon.com wrote:
I have an app using active_director y.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 "win32serviceut il.pyc", line 785, in SvcRun
File "XXProxySvc.pyc ", line 126, in SvcDoRun
File "XXProxySvc.pyc ", line 94, in setup
File "D:\projects\XX Proxy\DB.py", line 54, in loadFromAD
File "active_directo ry.pyc", line 402, in search
File "active_directo ry.pyc", line 398, in root
File "active_directo ry.pyc", line 371, in AD
File "active_directo ry.pyc", line 378, in _root
File "win32com\clien t\__init__.pyc" , line 73, in GetObject
File "win32com\clien t\__init__.pyc" , line 88, in Moniker
pywintypes.com_ error: (-2147221020, 'Invalid syntax', None, None)

The offending line is:
import active_director y as AD
...
for item in AD.search ("objectCategor y='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__.u pdate(kw)
# for the versioninfo resources
self.version = "0.9.0"
self.company_na me = "My Company"
self.copyright = "My Company (c)"
self.name = "FilterProx y"

############### ############### ############### ############### ####
# 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!
You may want to post this on gmane.comp.pyth on.py2exe also.

I'm going to try to guess what the problem is, but it is a little hard to tell
from here. py2exe does its best to find all the modules required to create the
..exe. Sometimes modules do dynamic imports, etc. of modules that "fool" py2exe.
I'm guessing that this is the case and that you will need to manually include
the missing module. Most such errors seem to fall into this category. Hope
this at least points you in the correct direction.

-Larry Bates
Sep 20 '06 #2
MaR
Thanks guys! :o)

It seems that no module is missing since the Service starts and the
error message seem to indicate an error in the COM call to the AD.
I would expect some other exception..

I do have a separate thread for the asyncore.loop() as I otherwise
would risk a lockup.

I do not call pythoncom.CoIni tialize () as I tend to expect a module
wrapping COM stuff to do that. Since I am not really into Windows, I
have to ask you, do I make a wrong assumption here?

Some further info that may be of interest:
python 2.4.3
active_director y 0.4
py2exe 0.6.5
pywin32 208
The Service code is taken from MyService.py supplied with py2exe as a
sample.

Rgrds//M

Sep 21 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

20
3711
by: Thomas Heller | last post by:
I'm currently working on a new version of py2exe, which will require Python 2.3 and later, because it uses the zipimport mechanism. Since py2exe is a distutils extension, and since C compilers are commonly available on most platforms except Windows, it would be fairly easy to let py2exe generate a C source file installing this import hook, and let distutils' C compiler build an executable file from this. Would this be useful, or would...
0
5237
by: Brad Clements | last post by:
I'm trying to get a simple service to work with py2exe and python 2.3 I get this error when I start it (after registering it) The description for Event ID ( 240 ) in Source ( UMXWIN32SVC ) cannot be found. The local computer may not have the necessary registry information or message DLL files to display messages from a remote computer. The following information is part of the event: 1063, The service process could not connect to the...
10
2269
by: Thomas Heller | last post by:
**py2exe 0.5.0** (finally) released =================================== py2exe is a Python distutils extension which converts python scripts into executable windows programs, able to run without requiring a python installation. News Python 2.3 is required, because the new zipimport feature is used.
1
3777
by: Peter Teniz | last post by:
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
2
2017
by: Bryan | last post by:
just for fun and my own experience, i wanted to use py2exe to wrap the wxpython demo. i put the setup script in the demo directory which is the following: from distutils.core import setup import glob import py2exe setup(windows=, data_files=,
0
1316
by: Thomas Heller | last post by:
**py2exe 0.5.2** released ========================= py2exe is a Python distutils extension which converts python scripts into executable windows programs, able to run without requiring a python installation. Console and Windows (GUI) applications, windows NT services, exe and dll COM servers are supported. This is a bugfix release.
4
1572
by: D | last post by:
I have a simple client/server file server app that I would like to convert to a single .exe. The client is just uses Tkinter and displays a simple GUI. The server has no GUI and just listens for and processes connections. How can I convert these 2 files to an .exe, while enabling the server app to register as a Windows service? Thanks. Doug
2
1386
by: K.S.Wong | last post by:
Hi all, I am trying to find out what tools (platform-independent if possible) that I can use to package a goup (few) of installers to become an exe application. I have heard of Py2exe but have not use it before. Could it be used to wrap different installers (for example Python and Leo, python-based application) together? Does the installers have to be python-based to be able to use Py2exe? Are there any other alternatives? Many...
5
2616
by: DarkPearl | last post by:
Bonjour à tous, apres avoir créer un service windows avec py2exe, j'ai ce probleme quand je lance le service : voici ce que je trouve dans le journal d'evenement : The instance's SvcRun() method failed <Error getting traceback - traceback.print_tb() failed <class 'pywintypes.com_error'>: (-2147221020, 'Syntaxe incorrecte',
0
9855
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9697
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
10648
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10293
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7828
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
7017
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5682
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
4064
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3134
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.