[python-win32] Dispatch error 'CoInitialize has not been called'
Bob Gailer
bgailer at alum.rpi.edu
Fri Dec 29 20:29:27 CET 2006
Tim Golden wrote:
> [Bob Gailer]
>
>> OK. I don't know whether its running in a thread. I made no
>> changes that I'm aware of that would cause the change in
>> behavior. I will add the call to pythoncom.CoInitialize. I am
>> not familiar with this method.
>>
>
> This is one of those gotcha's of Win32 COM programming;
> you can be happily using some code which runs fine. You
> then drop it into a [web server / service / scheduled job]
> and lo! you're now running in a thread.
>
Yeah, but when I said it was working, it was working in the server!
Wednesday AM just fine. Wednesday afternoon suddenly not working fine. I
swear I didn't change anything!
Is there some way my program can introspect? to see if it is in a thread?
> I'm not sure (and perhaps someone can advise) whether there's
> any harm in *always* calling CoInitialize!
--
Bob Gailer
510-978-4454
More information about the Python-win32
mailing list