That solution works only for interpreters that need another system state. It does not work for interpreters that should use different pre and post properties or command line arguments, because the initialize methods on PythonInterpreter and PySystemState are static methods that do nothing when initialization already happened before. In particular, using two instances of PythonInterpreter with different class paths is not possible.
-----Original Message-----
From: [] On Behalf Of Jeff Emanuel
Sent: Thursday, October 07, 2004 6:42 PM
To: Perez Carmona, David
Subject: RE: [Jython-users] Global Jython state

Construct your interpreters with there own instances of PySystemState.
Use the constructor that takes two arguments:
    public PythonInterpreter(new PyStringMap(), new PySystemState());
-----Original Message-----
From: [] On Behalf Of Perez Carmona, David
Sent: Thursday, October 07, 2004 9:35 AM
To: JyUsr (E-mail)
Subject: [Jython-users] Global Jython state

Dear Jythoners,
If I create in several threads different PythonInterpreter
    PythonInterpreter py = new PythonInterpreter();
    py.exec("print 'hi 1'");
    PythonInterpreter py = new PythonInterpreter();
    py.exec("print 'hi 2'");
The result is that both messages a printed to stream1, instead of separated streams.
Is PySystemState shared between all threads?.
Any hint will be greatly appreciated.