It seems that the only way to really "reset" the interpreter would be to recreate it as you mention.  I do agree with you that cleanup() seems that it should do the trick...but instead does nothing notable.

Can we ask what you are doing with the interpreter?  Are object factories (http://jythonpodcast.hostjava.net/jythonbook/chapter10.html#object-factories) a solution that may work for you?  If so, they are quite easy to use and there is a PySystemState object factory that performs fairly well.  This may be something for you to look into.  You may also want to take a look at using JSR-223 as it may do the trick for you.

Best

Josh Juneau
juneau001@gmail.com
http://jj-blogger.blogspot.com
Twitter ID:  javajuneau


On Fri, Nov 6, 2009 at 6:48 AM, Joonas Pulakka <joonas.pulakka@iki.fi> wrote:
Hello,

I've been told that creating a PythonInterpreter object is relatively expensive, and therefore it makes sense to cache/reuse it somehow. However, I'm having difficulties to "reset" the interpreter to its initial state. By resetting I mean clearing all previous variables, functions and class definitions. I thought interp.cleanup() would do something like that, but it doesn't seem to have any effect.

Is there a way to "reset" the interpreter, or should I just recreate it?

Best Regards,
Joonas

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Jython-users mailing list
Jython-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jython-users