[python-win32] Dispatch error 'CoInitialize has not been called'

Tim Golden Tim.Golden at viacom-outdoor.co.uk
Fri Dec 29 10:44:52 CET 2006


[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.

I'm not sure (and perhaps someone can advise) whether there's
any harm in *always* calling CoInitialize!

TJG 


Tim Golden 
Senior Analyst Programmer 
--------------------------------------------------------
Viacom Outdoor Ltd, Camden Wharf, 28 Jamestown Road, London, NW1 7BY T: 020 7482 3000 F: 020 7267 4944 
Email: Tim.Golden at viacom-outdoor.co.uk www.viacom-outdoor.co.uk

The contents of this e-mail are confidential to the ordinary user of the e-mail address to which it was addressed, and may also be privileged. If you are not the addressee of this e-mail you may not copy, forward, disclose or otherwise use it or any part of it in any form whatsoever. If you have received this e-mail in error, please e-mail the sender by replying to this message. Viacom Outdoor Ltd reserves the right to monitor e-mail communications from external/internal sources for the purposes of ensuring correct and appropriate use of Viacom Outdoor facilities.

________________________________________________________________________
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-win32 mailing list