[Python.NET] Cannot initialize OLE

Brian Lloyd brian.lloyd at revolutionhealth.com
Mon Dec 1 20:45:05 CET 2008

This probably has to do with the threading model being auto-magically
set for you when the CLR is cranked up, absent any prior initialization.

The managed version of python.exe is able to set the threading model
(to MTA I believe) because it is a managed executable. When you import
clr via the standard python.exe, you are probably getting the default
model (STA). I could have those backwards - its been a while ;)

If you are using the win32com extensions, you might be able to import
those, set the threading model for the process, then import clr. Not
sure if that will work, but its worth a shot. I don't think there is
any way to change the threading model once it's set.


On 12/1/08 8:53 AM, "Daniele Esposti" <expo at expobrain.net> wrote:

> Hi all,
> if I run my application (a wxPython frame with a wx.Activex Flash
> component) with the python.exe in pythonnet folder its work like expected.
> Instead, if I run my application with the standard Python interpreter,
> with clr.pyd in DLLs folder and Python.Runtime.dll in the same
> interpreter folder, I get a warnings says Cannot initialize OLE and the
> ActiveX is locked.
> I'm using Python 2.5.2 on a Windows XP SP3 machine, PythonNet
> 2.0-alpha2-clr2.0 compiled with VisualStudio Express 2008.
> Have I missing something ? Only clr.pyd and Python.Runtime.dll are
> needed or there are others resources to copy in Python interpreter folder ?
> Thanks in advance
> _________________________________________________
> Python.NET mailing list - PythonDotNet at python.org
> http://mail.python.org/mailman/listinfo/pythondotnet

Brian Lloyd         540.845.2975

brian.lloyd at revolutionhealth.com

More information about the PythonDotNet mailing list