Author andrewparks
Recipients andrewparks, zyasoft
Date 2016-10-27.14:59:13
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
Jim, thank you so much for your responses. I did not realise until you pointed it out that it was possible to interrupt a PythonInterpreter.exec() by simply doing a Thread.interrupt().

I was not aware of shutdownInterpreter(), and it seems to be the solution I was looking for. In fact, I didn't even realise from the Jython docs that I could use Thread.interrupt() to abort execution.

Thank you very much for helping me understand how to resolve this problem now. So although I know to fix my issue, a way to shutdown reset the PythonInterpreter rather than simply shut it down is still very welcome.

FYI, for anyone else coming across this page, here is the code that I didn't realise until now that I could have written to abort PythonInterpreter.exec():

PythonInterpreter pi = new PythonInterpreter();

    Thread jythonThread = new Thread(new Runnable() {
      public void run() {
        pi.exec("while 1: print 'hello'");


    new Thread(new Runnable() {
      public void run() {
        try {
        catch (InterruptedException e) {
Date User Action Args
2016-10-27 14:59:14andrewparkssetmessageid: <>
2016-10-27 14:59:14andrewparkssetrecipients: + andrewparks, zyasoft
2016-10-27 14:59:14andrewparkslinkissue2530 messages
2016-10-27 14:59:13andrewparkscreate