Using py2exe to wrap a service?

Tim Golden tim.golden at viacom-outdoor.co.uk
Wed Sep 20 10:19:44 EDT 2006


[Thomas Heller]
| Tim Golden schrieb:
| > [Maria.Reinhammar at accalon.com]
| > 
| > [... snip ...]
| > 
| > |   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'"):
| > 
| > Not infrequently -- and quite bizarrely -- "Invalid syntax"
| > errors in COM sometimes come down to a mishandling of threading. 
| > To ask the obvious: do you have a pythoncom.CoInitialize ()
| > somewhere in your code?
| > 
| > This is a bit invisible, because Services are inherently
| > threaded, while you were probably running it before
| > unthreaded.
| > 
| > May not be the answer, but worth a try.
| 
| Maybe another possibility is that py2exe fails to include makepy
| generated modules.  Could that lead to this error?

Could easily be. I vaguely remember some similar problem
with the WMI module, which I worked around by not doing
a dynamic import in the end... or something. Don't think
I've got the option here. (I wrote the active_directory
module, in case it wasn't clear).

TJG

________________________________________________________________________
This e-mail has been scanned for all viruses by Star. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________



More information about the Python-list mailing list