Using py2exe to wrap a service?

Tim Golden tim.golden at viacom-outdoor.co.uk
Thu Sep 21 05:52:45 EDT 2006


[MaR]
| Tim Golden wrote:
| > [MaR]
| >
| > | I do not call pythoncom.CoInitialize ()  as I tend to 
| expect a module
| > | wrapping COM stuff to do that.
| >
| > Hmmm. A slightly philosophical point.
| [snip]
| 
| :o) I agree!
| 
| I have added the CoInit.. call to the __init__() of the threaded class
| (I understood the documentation as that was a proper place.)
| The exception message changed!
| Unfortunately I get little wiser.. (yes I confess.. I am spoonfed with
| unix ;o)
| 
| The instance's SvcRun() method failed
|   File "win32serviceutil.pyc", line 785, in SvcRun
|   File "MailProxySvc.pyc", line 132, in SvcDoRun
|   File "MailProxySvc.pyc", line 100, in setup
|   File "D:\projects\MailProxy\AddressDB.py", line 54, in
| loadPersonsFromAD
|   File "active_directory.pyc", line 367, in search
|   File "active_directory.pyc", line 217, in query
|   File "win32com\client\gencache.pyc", line 540, in EnsureDispatch
|   File "win32com\client\CLSIDToClass.pyc", line 50, in GetClass
| exceptions.KeyError: '{B08400BD-F9D1-4D02-B856-71D5DBA123E9}'

OK. Now we're into the ClassID thing. I'm hoping that someone with
py2exe knowhow will chip in here. That line is trying to generate
a Python module to correspond to the ADODB.Command typelib:

command = EnsureDispatch ("ADODB.Command")

The py2exe wiki suggests that a slight nudge to the code
might fix the problem:

http://www.py2exe.org/index.cgi/IncludingTypelibs

At this point there are several options open to us:

(in no particular order)
1) You could nudge the code at line 217 to make use of
that suggestion.
2) I could do that and send you the result.
3) I could alter the module so it doesn't use gencache
at all. I don't seem to be using any constants so the
Dispatch might as well be dynamic.
4) None of the above.

I'm happy to do (3) and send it to you privately if you're
willing to try. Of course, it might not be the cause
of the problem in any case!

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