embedded python and windows multi threading, can't get it to work

Serge Orlov Serge.Orlov at gmail.com
Tue Jun 13 15:04:09 EDT 2006


freesteel wrote:
> I am trying to run a python programme embedded from C++. I want to run
> the same python code concurrently in several threads. I read the manual
> on embedding, especially chapter 8, and searched for relevant info on
> google all afternoon, but I can't get this to work. What am I doing
> wrong? I use python2.4 and vc++7 (.net). The first thread seems to work
> okay, the 2nd thread crashes, but the exception information is not very
> useful:
> (An unhandled exception of type 'System.NullReferenceException'
> occurred in pyembed_test.exe

Running one iterpreter in more than one thread is not supported. You
need to create one interpreter per thread using Py_NewInterpreter
(don't forget to read "Bugs and caveats" paragraph). I hope you also
realize the interpreters won't share objects.




More information about the Python-list mailing list