[Zope] Integrating Zope with Excel.

Toby Dickenson tdickenson at devmail.geminidataloggers.co.uk
Tue Aug 31 11:37:19 EDT 2004


On Friday 27 August 2004 18:39, Joe Goldthwaite wrote:
> He also suggested that I manually call pythoncom.CoInitialize(). 

You need to call it once in every thread, to initialize com *for* *that* 
*thread*.

calling it before every request is a quick way to ensure that it is called at 
least once. the redundant calls probably wont do any short term harm, but its 
bad style. Traditionally CoInitialize is called by the code that creates the 
thread - it doesnt belong in application code.

pythoncom.CoInitialize() will initialize your threads using com's apartment 
threading mode, which is not 100% identical to zope's threading rules. To be 
safe you really should be using CoInitializeEx and some other magic 
parameters.  This has come up many times before..... check out 
http://www.zopelabs.com/cookbook/993002968, or google for "dickenson zope 
coinitializeex"

-- 
Toby Dickenson


More information about the Zope mailing list