COM and threading, "CoInitialize"?

Tim Golden mail at timgolden.me.uk
Tue Feb 10 09:14:51 EST 2009


Ferdinand Sousa wrote:
> Greetings to list members,
> 
> I am trying to use an Acrobat COM object in a class that is subclassed from
> threading.Thread.
> Since threading.Thread is subclassed, the __init__ method of the inheriting
> class must explicitly call the threading.Thread.__init__ method of the
> parent. I guess I'm missing something similar for the COM object. Threading
> code and traceback below. Any pointers?

[... snip lots of code and traceback ...]

> com_error: (-2147221008, 'CoInitialize has not been called.', None, None)
> ==================================

Well, much as I may grumble about opaque error messages, you're not going
to find one much more explicit than this. Try calling CoInitialize,
once per thread, eg before your Dispatch line. You'll have to import
pythoncom and then just call pythoncom.CoInitialize ()

TJG



More information about the Python-list mailing list