org.python.util.PythonInterpreter.cleanup()方法的使用及代码示例

x33g5p2x  于2022-01-26 转载在 其他  
字(3.5k)|赞(0)|评价(0)|浏览(207)

本文整理了Java中org.python.util.PythonInterpreter.cleanup()方法的一些代码示例,展示了PythonInterpreter.cleanup()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。PythonInterpreter.cleanup()方法的具体详情如下:
包路径:org.python.util.PythonInterpreter
类名称:PythonInterpreter
方法名:cleanup

PythonInterpreter.cleanup介绍

暂无

代码示例

代码示例来源:origin: org.python/jython

/**
 * Close down the modjy servlet.
 *
 */
@Override
public void destroy( ) {
  interp.cleanup();
}

代码示例来源:origin: com.alexkasko.krakatau/krakatau-lib

/**
 * Calls cleanup on interpreter instance
 */
public void cleanup() {
  if (null != python) {
    python.cleanup();
  }
}

代码示例来源:origin: co.cask.hydrator/core-plugins

@Override
public void destroy() {
 if (interpreter != null) {
  interpreter.cleanup();
 }
}

代码示例来源:origin: org.python/jython

@Override
  public void close() {
    if (!closed) {
      closed = true;
      cleanup();
    }
  }
}

代码示例来源:origin: org.python/jython

public void destroy() {
  if (cached != null) {
    cached.destroy();
  }
  if (interp != null) {
    interp.cleanup();
  }
}

代码示例来源:origin: org.zkoss.zk/zk

public void destroy() {
  _ip.cleanup();
  _ip = null;
  super.destroy();
}

代码示例来源:origin: org.zkoss.zk/zkmax

public void destroy() {
  _ip.cleanup();
  _ip = null;
  super.destroy();
}

代码示例来源:origin: langurmonkey/gaiasky

/**
 * Cancels the running script identified by the given path.
 * @param path The path.
 */
public void cancelScript(String path) {
  if (currentScripts.containsKey(path)) {
    ScriptRunnable sr = currentScripts.get(path);
    try {
      // TODO Figure a better way than this to stop the script
      sr.stop();
    } catch (Exception e) {
      EventManager.instance.post(Events.JAVA_EXCEPTION, e);
    }
    sr.interpreter.cleanup();
    sr.cleanup();
  }
}

代码示例来源:origin: org.nuiton.jrst/jrst

interp.cleanup();

代码示例来源:origin: org.nuiton.jrst/jrst

interp.cleanup();

代码示例来源:origin: com.googlecode.the-fascinator/fascinator-core

try {
  scriptClass = python.get(SCRIPT_CLASS_NAME);
  python.cleanup();
} catch (Exception ex) {
  log.error("Error accessing class: '{}'", SCRIPT_CLASS_NAME, ex);

代码示例来源:origin: org.python/jython

/**
 * Show that a {@link PlainConsole} may be replaced with a {@link JLineConsole}.
 */
@Test
public void testChangeConsole() throws Exception {
  System.out.println("testChangeConsole");
  // In the case where this test is run in isolation, cause initialisation with PlainConsole
  System.getProperties().setProperty(PYTHON_CONSOLE, "org.python.core.PlainConsole");
  PythonInterpreter interp = new PythonInterpreter();
  // Now replace it
  Py.installConsole(new JLineConsole(null));
  jython.run(commands);
  Console console = Py.getConsole();
  assertEquals(JLineConsole.class, console.getClass());
  interp.cleanup();
}

代码示例来源:origin: com.googlecode.the-fascinator.plugins/plugin-indexer-solr

/**
 * Evaluate and return a Python script.
 * 
 * @param inStream : InputStream containing the script to evaluate
 * @param scriptName : filename of the script (mainly for debugging)
 * @return PyObject : Compiled result
 */
private PyObject evalScript(InputStream inStream, String scriptName) {
  // Execute the script
  PythonInterpreter python = new PythonInterpreter();
  python.execfile(inStream, scriptName);
  // Get the result and cleanup
  PyObject scriptClass = python.get(SCRIPT_CLASS_NAME);
  python.cleanup();
  // Instantiate and return the result
  return scriptClass.__call__();
}

代码示例来源:origin: org.jvnet.hudson.plugins/jython

public boolean perform(AbstractBuild<?,?> build, Launcher launcher, BuildListener listener)  throws IOException, InterruptedException {
    PySystemState sys = new PySystemState();
    sys.setCurrentWorkingDir(build.getWorkspace().getRemote());
    PythonInterpreter interp = new PythonInterpreter(null, sys);

    interp.setOut(listener.getLogger());
    interp.setErr(listener.getLogger());
    interp.exec(this.getCommand());
    interp.cleanup();

    build.setResult(Result.SUCCESS);
    return true;
  }
}

代码示例来源:origin: org.python/jython

interp.cleanup();

代码示例来源:origin: org.python/jython

interp.cleanup();

相关文章