[mod_python] mod_python / win32all and COM

Stephane Bidoul sbi at acse.be
Thu Aug 10 19:40:09 EST 2000


I think you need to put COM in free-threaded mode
by doing

>>> sys.coinit_flags = 0

before anything else.

There is a mention of this in the Python COM readme,
but and can't recall where it's documented in more details...

Tell me if it works for you.

-sbi

----- Original Message -----
From: "Robert Nasca" <Robert.Nasca at macquarie.com.au>
To: <mod_python at modpython.org>
Sent: Tuesday, 08 August, 2000 01:27
Subject: [mod_python] mod_python / win32all and COM


> Hi,
>
> 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__
>     self.openConnection("DSN=RISK_REPORTER")
>   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.
>
> Thanks,
> Rob.
>
>





More information about the Mod_python mailing list