Reinitializing the python interpreter form Java
Ype Kingma
ykingma at accessforall.nl
Wed May 30 11:11:33 EDT 2001
"Andre M. Descombes" wrote:
>
> Ok, good Idea, but what will happen to the variables I pass that way, will
> they be still accessible from another function that I call? they shouldn't
> be there at all anymore, they should go out of scope as soon as I exit the
> function.
>
The globals are formed by a dictionary, so you can delete an entry
(untested code:)
theLatestCopyOfYourGlobals['varName'] = valueYouWantToPass
interpreter.exec(yourfile, theLatestCopyOfYourGlobals)
del theLatestCopyOfYourGlobals['varName']
interpreter.otherthings(...)
You can also do:
del varName
in yourfile.
Good luck,
Ype
More information about the Python-list
mailing list