[pygtk] Can't run PyGTK more than once from embedded Python
Patrick K. O'Brien
pobrien at orbtech.com
Mon Jan 9 22:44:50 WST 2006
Romain Behar wrote:
> I've finally found the bug: to run PyGTK scripts
> properly, one has to create only one Python
> interpreter and use it to launch all scripts. My
> application was creating a new interpreter each time
> it ran a new script.
That is significant. In my case, I *had* to start a new interpreter in
order to guarantee that each execution of the script was running in a
pristine environment. I made the mistake of assuming you had a similar
need. (I also somehow assumed you were running on Windows...)
Just keep in mind that it is very difficult to completely "clean up" a
python interpreter and that there is the possibility that when you
launch a script it might be influenced by a previous script. For
example, module attributes set by one script will likely be visible to
subsequent scripts. As long as you are aware of that and it isn't a
problem for your application, life is much easier if you create one
embedded Python interpreter and allow it to live for the duration of
your main program.
--
Patrick K. O'Brien
Orbtech http://www.orbtech.com
Schevo http://www.schevo.org
Louie http://louie.berlios.de
More information about the pygtk
mailing list