It is possible to get the variables currently in use in the Python program with the method getLocals() on the PythonInterpreter. At a later stage you can give the result of this method to the constructor of PythonInterpreter and have all your variables at your disposal again. You can also serialize the variables and start a new PythonInterpreter at a later time, even on a different JVM or a different machine.
I was wondering if it is possible to get the complete state of the interpreter, i.e. also the stack and the instruction pointer. From what I’ve seen it is currently not possible to do this, but I was wondering how hard it would be to achieve this. One way might be to have the PythonInterpreter (and all classes it uses) implement Serializable. Or create new methods on PythonInterpreter, e.g. getStack() and getInstructionPointer(), and create a new constructor for PythonInterpreter.
Any ideas on this?
Jan Sipke van der Veen
This e-mail and its contents are subject to the DISCLAIMER at http://www.tno.nl/emaildisclaimer