Johan Dahlin wrote: >> Unfortunately, it's not possible to have a single >> interpreter. For example, more than one document can >> be opened and each of them can have an interpreter >> instance. Every other Python library tested works >> properly with multiple interpreters. 'pygtk' module >> doesn't complain, only 'gtk' one does. If the issue >> comes from the gtk extension modules being initialized >> multiple times, I'll add a bug to the tracker. > > > You can have different namespaces inside the same interpreter.
Right. Unfortunately there *are* limits to this approach in so far as imported modules can act as a sort of global namespace, with potentially undesirable consequences. On the other hand... > Running multiple interpreters inside the same process is not > officially supported in python. You're likely to run into many > complex, hard to fix problem which no one wants to help you solve. As much as I wish it were otherwise, I completely agree. I worked very hard to find a solution to this and came up empty-handed. I think your major alternatives are: * one embedded interpreter, separate namespaces, potential disruption due to modules as global namespace (the potential disruption usually being fairly minimal unless you have untrusted scripts, in which case anything can happen) * write your main app in Python and make use of C modules from there Here is an important question - are the scripts you are launching ones that you have written and are supplying with your main application, or are they being written by end-users? And what is your level of responsibility if one of these scripts did something evil? -- Patrick K. O'Brien Orbtech http://www.orbtech.com Schevo http://www.schevo.org Louie http://louie.berlios.de _______________________________________________ pygtk mailing list [email protected] http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
