[python-win32] Python service hangs in Dispatch when frozen with py2exe

Don Dwiggins ddwiggins at advpubtech.com
Wed May 19 23:46:31 CEST 2010


I'm developing a Python service under Win XP with Python 2.5 (the 
service is built on Twisted's XMLRPC server).  For delivery to 
production, I "compile" it with py2exe.  It's been running fine, but 
I've hit a snag.

I've written new code to access a COM object (in a DLL); the code I've 
written does works successfully as long as I'm running the source under 
PythonService.

The compiled version, however, hangs up in the call to Dispatch to get 
the COM object.  I've put in debugging log entries all through the 
relevant section of code, and it's clear that it simply never returns 
from the Dispatch call.  I've tried EnsureDispatch as well, and more 
recently the following code:

>   iab = IA.clsAuthorizeBatch()
>   auth = DispatchEx(iab.CLSID)

... where I've imported the gen_py module under the name IA (I've copied 
the module file to the same folder as the service, so there's no issue 
with py2exe or the executable not being able to find it).  In this case, 
the hangup occurs in the first statement.  I've tried running the code 
with and without wrapping it in CoInitialize/Couninitialize.

I've run out of things I can think of to try, or even to get a hint of 
what might be getting hung up.  One last bit of data: looking at the 
process in Process Explorer, I see that it's very busy for several 
seconds (about 50% CPU), then goes quiet.

Any good words appreciated,
-- 
Don Dwiggins
Advanced Publishing Technology



More information about the python-win32 mailing list