Reinitializing the python interpreter form Java
Andre M. Descombes
amdescombes at diligo.fr
Fri May 25 09:12:56 EDT 2001
Hi Ype,
I tried your method, but when I have global variables, they don't seem to be
changing their values after I do the setLocals, even with then copy()
instruction.
Any Idea what might be happening?
Thanks,
Andre M. Descombes
> > I tried using getLocals and setLocals with no success.
>
> Did you make a copy of the dictionary returned by getLocals()?
>
> savedLocals = getLocals().copy()
>
> Each time you run your program you will have to pass it a fresh
> copy of this copy, too:
>
> interpr.setLocals(savedLocals.copy())
>
> The fresh copy will give the restore effect.
>
> Have fun,
> Ype
More information about the Python-list
mailing list