سؤال

I am using ADO to connect to an SQL server from cherrypy. Where should I be putting :

 pythoncom.CoInitialize()  

inside the __init__ or inside the index method where the GET is performed?

Thanks!

هل كانت مفيدة؟

المحلول

Refer to MSDN for COM info. You should call it once for every additional thread in the app, so I guess you either need to hack into the thread pool or have a thread-local flag if COM is initialized. Note that you should to call CoUninitialize() when thread terminates, and that is another problem that you cannot solve with the flag.

Or you could use a different DB lib like pyodbc--it doesn't seem to use COM.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top