Message11449

Author tkohn
Recipients andrewparks, tkohn, zyasoft
Date 2017-06-25.22:12:59
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1498428780.56.0.501786318407.issue2530@psf.upfronthosting.co.za>
In-reply-to
Content
For what it is worth: I had a similar problem and needed a possibility to abort execution of a Python program. I used the trace-function to achieve my goal, basically:
  Py.getThreadState().tracefunc = myTraceFunction;
"myTraceFunction" is an instance of a class extending "org.python.core.TraceFunction".

This way, before executing a line, I have Jython check if an "abort"-flag is set. If so, a simple exception is thrown, causing the interpreter to actually abort and report the exception -- which is, of course, caught by my code. I have never had any problems restarting another Python script in the same JVM afterwards (I am not talking about freeing all the resources here, just the basic concept).

If there was such a mechanism already built in, that would be a great help, though.
History
Date User Action Args
2017-06-25 22:13:00tkohnsetmessageid: <1498428780.56.0.501786318407.issue2530@psf.upfronthosting.co.za>
2017-06-25 22:13:00tkohnsetrecipients: + tkohn, zyasoft, andrewparks
2017-06-25 22:13:00tkohnlinkissue2530 messages
2017-06-25 22:12:59tkohncreate