Roger Upole wrote: > Bob Gailer wrote: > >> I'm running this under my Apache2triad mod_python installation. >> Yesterday it was working. Today it is not. >> In the Apache config mptest.py is defined as the request handler. When >> called via an HTTP request I get the following: >> >> Traceback (most recent call last): >> >> File "H:\Python24\Lib\site-packages\mod_python\apache.py", line 299, >> in HandlerDispatch >> result = object(req) >> >> File "H:/apache2triad/htdocs/output/mptest.py", line 45, in handler >> if actHandler: actHandler(req, parameters) >> >> File "H:/apache2triad/htdocs/output/mptest.py", line 52, in search >> connect() >> >> File "H:/apache2triad/htdocs/output/mptest.py", line 26, in connect >> conn = win32com.client.Dispatch("ADODB.Connection") >> >> File "H:\Python24\lib\site-packages\win32com\client\__init__.py", line >> 95, in Dispatch >> dispatch, userName = >> dynamic._GetGoodDispatchAndUserName(dispatch,userName,clsctx) >> >> File "H:\Python24\lib\site-packages\win32com\client\dynamic.py", line >> 98, in _GetGoodDispatchAndUserName >> return (_GetGoodDispatch(IDispatch, clsctx), userName) >> >> File "H:\Python24\lib\site-packages\win32com\client\dynamic.py", line >> 78, in _GetGoodDispatch >> IDispatch = pythoncom.CoCreateInstance(IDispatch, None, clsctx, >> pythoncom.IID_IDispatch) >> >> com_error: (-2147221008, 'CoInitialize has not been called.', None, None) >> >> Trying the same thing in the PythonWin interactive window - it works >> just fine. >> >> > > If it's running in a thread, you need to call pythoncom.CoInitialize yourself. > 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. .... time passes .... OK I added it and now it works. Thanks.
-- Bob Gailer 510-978-4454 _______________________________________________ Python-win32 mailing list Python-win32@python.org http://mail.python.org/mailman/listinfo/python-win32