Python Embedding Thread

Graham Dumpleton Graham.Dumpleton at
Wed Jul 23 14:50:25 CEST 2008

On Jul 23, 12:15 pm, "Jaimy Azle" <ja... at> wrote:
> <googler.1.webmas... at> wrote:
> > I fixed the code. This code snippet runs in a seperate thread:
> > PyObject *dict=NULL;
> > PyGILState_STATE state = PyGILState_Ensure();
> > dict = CreateMyGlobalDictionary();
> > PyRun_String(<my code>, Py_file_input, dict, dict);
> > ReleaseGlobalDictionary(dict);
> > But it still does not work... :-/
> Have you initialize interpreter with PyEval_InitThreads? look at more information.
> Oh, btw... I did use python in a bit different scenario than you've
> described. Since you attempt to run different script per-host thread, you
> might need python multiple interpreter support, I suggest you take a lookmod_pythonimplementation.

Please don't look at mod_python. Current versions of mod_python don't
use Python simplified GIL APIs correctly.

Look at mod_wsgi instead, it is closer to the mark, although still has
some not quite cruft in there to workaround mistakes in mod_python for
case where mod_python and mod_wsgi are being loaded together. :-(


More information about the Python-list mailing list