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

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

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

PythonInterpreter.getSystemState介绍

暂无

代码示例

代码示例来源:origin: apache/flink

private static synchronized PythonInterpreter initPythonInterpreter(String[] args, String pythonPath, String scriptName) {
    if (!jythonInitialized) {
      // the java stack traces within the jython runtime aren't useful for users
      System.getProperties().put("python.options.includeJavaStackInExceptions", "false");
      PySystemState.initialize(System.getProperties(), new Properties(), args);

      pythonInterpreter = new PythonInterpreter();

      pythonInterpreter.getSystemState().path.add(0, pythonPath);

      pythonInterpreter.setErr(System.err);
      pythonInterpreter.setOut(System.out);

      pythonInterpreter.exec("import " + scriptName);
      jythonInitialized = true;
    }
    return pythonInterpreter;
  }
}

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

/**
 * Sets a Python object to use for the standard output stream, <code>sys.stderr</code>. This
 * stream is used in a byte-oriented way (mostly) that depends on the type of file-like object,
 * in the same way as {@link #setOut(PyObject)}.
 *
 * @param outStream Python file-like object to use as the error output stream
 */
public void setErr(PyObject outStream) {
  getSystemState().stderr = outStream;
}

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

/**
 * Sets a Python object to use for the standard input stream, <code>sys.stdin</code>. This
 * stream is used in a byte-oriented way, through calls to <code>read</code> and
 * <code>readline</code> on the object.
 *
 * @param inStream a Python file-like object to use as the input stream
 */
public void setIn(PyObject inStream) {
  getSystemState().stdin = inStream;
}

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

getSystemState().stdout = outStream;

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

protected void setSystemState() {
  Py.setSystemState(getSystemState());
}

代码示例来源:origin: org.jspringbot/jspringbot

public void setRecursionLimit(int recursionLimit) {
  interpreter.getSystemState().setrecursionlimit(recursionLimit);
}

代码示例来源:origin: stackoverflow.com

PythonInterpreter interpreter = new PythonInterpreter(null, new PySystemState());
 PySystemState sys = interpreter.getSystemState();
 sys.path.append(new PyString("\\python_modules\\pymongo-3.3.0-cp26-none-win_amd64.whl"));

代码示例来源:origin: stackoverflow.com

PythonInterpreter pi = new PythonInterpreter();
pi.getSystemState().path.append(new PyString("path/to/java/modules.jar"));

相关文章