PySystemState state = new PySystemState(); state.setClassLoader(classLoader); PythonInterpreter interp = new PythonInterpreter(table, state);
@Override protected void setUp() throws Exception { interp = new PythonInterpreter(new PyStringMap(), new PySystemState()); }
protected PythonInterpreter initInterpreter(Set<String> dependencies) { logger.info("Creating python interpreter with [" + dependencies.size() + "] dependencies [" + dependencies + "]"); if(!dependencies.isEmpty()) { PySystemState systemState = new PySystemState(); for (String dependency: dependencies) { systemState.path.append(new PyString(dependency)); } return new ThreadSafePythonInterpreter(systemState); } return GLOBAL_INTERPRETER; }
protected PythonInterpreter initInterpreter(Set<String> dependencies) { logger.info("Creating python interpreter with [" + dependencies.size() + "] dependencies [" + dependencies + "]"); if(!dependencies.isEmpty()) { PySystemState systemState = new PySystemState(); for (String dependency: dependencies) { systemState.path.append(new PyString(dependency)); } return new ThreadSafePythonInterpreter(systemState); } return GLOBAL_INTERPRETER; }
@Override public void initialize(UimaContext context) throws ResourceInitializationException { super.initialize(context); interp = new PythonInterpreter(null, new PySystemState()); // LATER allow for nonstandard Python modules // PySystemState sys = Py.getSystemState(); // sys.path.append(new PyString(rootPath)); // sys.path.append(new PyString(modulesDir)); try { scriptFileIs = ResourceHelper.getInputStream(scriptPath); } catch (Exception e) { throw new ResourceInitializationException( ResourceInitializationException.NO_RESOURCE_FOR_PARAMETERS, new Object[] { scriptPath }); } }
final PySystemState state = new PySystemState(); state.setClassLoader(new MyClassLoader()); Py.setSystemState(state);
PySystemState engineSys = new PySystemState(); String sphinxSourceDirectory = null; List<String> sphinxArgs = new ArrayList<String>(Arrays.asList(args));
Properties systemProperties = System.getProperties(); PySystemState.initialize(systemProperties, properties, new String[]{""}); PySystemState pySystemState = new PySystemState(); JythonClassLoader classLoader = new JythonClassLoader(getClass().getClassLoader(), bundle); pySystemState.setClassLoader(classLoader);
@Override protected void setUp() throws Exception { interp = new PythonInterpreter(new PyStringMap(), new PySystemState()); interp.exec("from java.io import Serializable"); interp.exec("class Test(Serializable): pass"); interp.exec("x = Test()"); }
@Override protected void setUp() throws Exception { PySystemState sys = new PySystemState(); interp = new PythonInterpreter(new PyStringMap(), sys); }
private void setPythonPath(SpongeEngine engine) { if (engine != null) { String pythonPath = getEngineOperations().getProperty(PROP_PYTHON_PATH, null); if (pythonPath != null) { PySystemState engineSys = new PySystemState(); List<String> paths = Arrays.asList(StringUtils.split(pythonPath, PROP_PATH_SEPARATOR)); Collections.reverse(paths); for (String pathElement : paths) { engineSys.path.add(0, Py.newString(pathElement)); } Py.setSystemState(engineSys); } } }
@Override protected void setUp() throws Exception { PySystemState sys = new PySystemState(); interp = new PythonInterpreter(new PyStringMap(), sys); }
@Override protected void setUp() throws Exception { interp = new PythonInterpreter(new PyStringMap(), new PySystemState()); a = new WrappedBoolean(); b = new WrappedBoolean(); a.setMutableValue(true); b.setMutableValue(false); interp.set("a", a); interp.set("b", b); }
@Override protected void setUp() throws Exception { interp = new PythonInterpreter(new PyStringMap(), new PySystemState()); a = new WrappedInteger(); b = new WrappedInteger(); a.setMutableValue(13); b.setMutableValue(17); interp.set("a", a); interp.set("b", b); }
@Override protected void setUp() throws Exception { interp = new PythonInterpreter(new PyStringMap(), new PySystemState()); a = new WrappedFloat(); b = new WrappedFloat(); a.setMutableValue(13.0); b.setMutableValue(17.0); interp.set("a", a); interp.set("b", b); }
@Override protected void setUp() throws Exception { interp = new PythonInterpreter(new PyStringMap(), new PySystemState()); a = new WrappedLong(); b = new WrappedLong(); a.setMutableValue(13000000000L); b.setMutableValue(17000000000L); interp.set("a", a); interp.set("b", b); }
PySystemState systemState = new PySystemState(); interp = new PythonInterpreter(null, systemState); setupEnvironment(interp, props, systemState);
protected static PythonInterpreter createInterpreter(ServletContext servletContext) { String rootPath = getRootPath(servletContext); PySystemState sys = new PySystemState(); PythonInterpreter interp = new PythonInterpreter(Py.newStringMap(), sys); sys.path.append(new PyString(rootPath)); String modulesDir = rootPath + "WEB-INF" + File.separator + "jython"; sys.path.append(new PyString(modulesDir)); return interp; }
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; } }
Py.defaultSystemState = new PySystemState(); Py.setSystemState(Py.defaultSystemState); if (classLoader != null) {