[mod_python] mod_python / win32all and COM

Robert Nasca Robert.Nasca at macquarie.com.au
Tue Aug 8 09:27:12 EST 2000


Is there an FAQ on using mod_python with COM? It seems that I am having problems due to the threaded nature of Apache on win32 and it's interaction with COM.

I have created an interface to some COM objects using the "makepy.py" program which comes with win32all.

When I run Apache with ThreadsPerChild set to 1, everything runs fine (albeit with only one client), but when I set this to something higher, I get errors saying "CoInitialise() has not been called", which I assume are related to Apache spawning multiple threads. I've attached the output below.

Mod_python error: "PythonHandler pytest"Traceback (innermost last):
  File "h:\website\python\mod_python\apache.py", line 119, in Dispatch
    result = object(req)
  File "h:/website/htdocs/test\pytest.py", line 8, in handler
    d = Snakey.Database.RiskReporterDatabase()
  File "H:\WebSite\Python\Snakey\Database.py", line 32, in __init__
  File "H:\WebSite\Python\Snakey\Database.py", line 20, in openConnection
    self.connection = msado21.Connection()
  File "H:\PythonDev\Snakey\msado21.py", line 1607, in __init__
com_error: (-2147221008, 'CoInitialize has not been called.', None, None)

If anyone has a suggestion on what is happening, or pointers to some information on using mod_python and COM, it would be appreciated.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.modpython.org/pipermail/mod_python/attachments/20000808/8ccbceb4/attachment-0003.htm

More information about the Mod_python mailing list