java - How can I force a Python ScriptEngine to flush its cache of imported modules? -
i using python scriptengine in java application execute python script imports various other python scripts.
once main script completes , eval method returns, set engine object reference null , call garbage collector.
next go , edit 1 of scripts imported main script , save it.
next run method execute main python script before creating new scriptengine object , calling eval, when main script runs not pick changes imported script made.
obviously imported scripts being cached somewhere (maybe jython?).
i not want call reload in python script. there must way tell whatever doing caching flush or clear itself.
anyone found solution problem? using netbeans 8.0.2, java 1.8 update 45, , jython 2.7 on windows 7. here java code. doesn't matter python script contains other import statements.
scriptenginemanager scriptenginemanager = new scriptenginemanager(); scriptengine engine = scriptenginemanager.getenginebyname("python"); object result = engine.eval(); engine = null; system.gc();
Comments
Post a Comment