Ah.  Simply unhooking the UI console streams from the InteractiveConsole (setting them back to System.out and System.err) clears up my exceptions, but I am not sure I am actually killing the interpreter.  What is the default exit function for PySystemState (called by cleanup())?  Here is what I am currently doing when I dispose my console (this is in a UI where the user can open/close as many Jython consoles as they wish):

        interp.setOut(System.out);
        interp.setErr(System.err);
        interp.cleanup();
        interp = null;

(interp is an instance of InteractiveConsole)

M.
----------------------------------------------------------



Mark_Melvin@amis.com
Sent by: jython-users-bounces@lists.sourceforge.net

08/22/2007 10:00 AM

To
jython-users@lists.sourceforge.net
cc
Subject
[Jython-users] How To Programmatically Shut Down InteractiveConsole






Hi All,


This seems like a silly question, but what is the recommended way of programmatically shutting down an embedded InteractiveConsole if you cannot send it a CTRL+Z from the keyboard?  I want to be able to open and close interpreters programmatically and I keep getting exceptions if I close the streams.  But I can't seem to find a way to send a shutdown signal the the interpreter.  Is there a way to do this that I am missing, or do I need to subclass InteractiveInterpreter and make my own console that looks for a certain event?


Thanks,

Mark.



AMI Semiconductor - "Silicon Solutions for the Real World"
NOTICE: 
This electronic message contains information that may be confidential or privileged. The information is intended for the use of the individual or entity named above. If you are not the intended recipient, please be aware that any disclosure, copying, distribution or use of the contents of this information is prohibited. If you received this electronic message in error, please notify the sender and delete the copy you received.