1

I'm connecting to MS Word by win32com.client.Distpatch function and on the second request i've got error: 'CoInitialize has not been called.' I've found this topic:

http://www.velocityreviews.com/forums/t328097-coinitialize-error-when-using-adodbapi.html

and got that I have to call of CoInitialize in new thread. So question is where to call CoInitialize function in pyramid.

xliiv
  • 5,399
  • 5
  • 29
  • 35

1 Answers1

5

So i added call of CoInitialize in function:

@subscriber(NewRequest)
def new_request_subscriber(event):
    import pythoncom
    pythoncom.CoInitialize()

and works without exception.

xliiv
  • 5,399
  • 5
  • 29
  • 35