Hi Guy -- as far as I know, you can't change the thread 
state after any COM or interop calls have happened (and 
Python for .NET is all interop...).

What you probably need to do is set the attribute in 
the C# 'embedding' application before initializing the 
python engine (or making any other interp calls). 

On Mon, 12 Sep 2005 15:38:55 +1200
 Guy Robinson <[EMAIL PROTECTED]> wrote:
>  From the attached code.With AllowDrop = True I get a
> .NET error as follows:
> 
> System.InvalidOperationException: DragDrop registration
> failed. ---> System.Threading.ThreadStateException: The
> current thread must set to Single Thread Apartment (STA)
> mode before OLE calls can be made.  Ensure that your Main
> function has STAThreadAttribute marked on it.
> 
>  From googling I need to set ApartmentState.STA. But this
> is readonly. How do I 
> set STA correctly in Python for .NET?
> 
> Any thoughts appeciated.
> 
> Guy
> 

_________________________________________________
Python.NET mailing list - PythonDotNet@python.org
http://mail.python.org/mailman/listinfo/pythondotnet

Reply via email to