Python Embedding Thread
Jaimy Azle
jazle at nospam.log.web.id
Tue Jul 22 22:15:44 EDT 2008
<googler.1.webmaster at spamgourmet.com> 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
http://www.python.org/doc/1.5.2/api/threads.html for 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 look
mod_python implementation.
Salam,
-Jaimy.
More information about the Python-list
mailing list