> Thanks for the hints, I will try to modify the sample now to make it > work using inter thread marshalling. > > But isn't it possible to have all the threads in the python > COM server run in a single MTA?
Not when the hosting application (VB in this case) is not in the MTA. You either need to convince VB to live in the MTA (which we have already agreed you can't), or live with it <wink>. > Instead of having several worker threads in several STA's in > the python > COM server with marshalling between the STA's. The threads you create are under your control, yes. So assuming you arrange for all threads to be in the MTA, you can freely share objects between the threads. You can't share the object with any threads not in the MTA though - which includes the (one and only) VB thread that is not in the MTA. In this specific case, the problem is we store the object/pointer, unmarshalled, in the instance. If we could store the marshalled object, all other threads would be fine. I'm not sure now to simply get the MTA marshalled object in a non-MTA thread, but it may be possible. Worst case you could spin a new thread just to marshall it! > This way, I don't need to implement marshalling between > threads in the > python COM server and the marshalling could be done > implicitely between > the python COM server (created in the MTA) and the VB6 gui > (running in > an STA). Yes, that is fine - just not for the VB thread. VB will only have one thread - so in effect, your "main thread" is not in the free-threaded apartment, but all other threads can be. Mark. _______________________________________________ Python-win32 mailing list Python-win32@python.org http://mail.python.org/mailman/listinfo/python-win32