Bob Gailer wrote:
> 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!

Multiple calls to CoInitialize don't hurt anything.  However (and I should have
mentioned this before) you also need to call CoUninitialize yourself at the end
of the thread.

       Roger


_______________________________________________
Python-win32 mailing list
Python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32

Reply via email to