I understand you are using SAPI. web2py does not have a mechanism for registering events with the start_thread and stop_thread action.
How about you call def index(): CoInitialize() ... SAPI call ... CoUninitialize() return ... in your controller functions that need the SAPI call? Would it work? On Sep 7, 6:41 am, mdipierro <[email protected]> wrote: > Are you using web2py as a windows service? > > On Sep 6, 8:58 pm, weheh <[email protected]> wrote: > > > I'm getting the following error message from the code that used to > > work a few weeks ago and haven't changed: > > > File "C:\Program Files\Python25\Lib\site-packages\win32com\client > > \dynamic.py", line 84, in _GetGoodDispatch > > IDispatch = pythoncom.CoCreateInstance(IDispatch, None, clsctx, > > pythoncom.IID_IDispatch) > > com_error: (-2147221008, 'CoInitialize has not been called.', None, > > None) > > > I looked up the com error and found numerous threads that deal with > > it. Here's one: > > >http://www.cherrypy.org/wiki/UsingCOMObjects > > > It appears that something has been upgraded and that com threads need > > to be initialized within web2py.

