public PythonInterpreter(PyObject dict, PySystemState systemState) { if (dict == null) dict = new PyStringMap(); if (systemState == null) { systemState = Py.getSystemState(); if (systemState == null) systemState = new PySystemState(); } module = new PyModule("main", dict); this.systemState = systemState; locals = module.__dict__; setState(); }
public PythonInterpreter(PyObject dict, PySystemState systemState) { if (dict == null) { dict = new PyStringMap(); } if (systemState == null) { systemState = Py.getSystemState(); if (systemState == null) { systemState = new PySystemState(); } } this.systemState = systemState; setState(); module = new PyModule("__main__", dict); systemState.modules.__setitem__("__main__", module); locals = dict; }
public void execfile(java.io.InputStream s, String name) { setState(); Py.runCode((PyCode) Py.compile_flags(s, name, "exec", cflags), locals, locals); Py.flushLine(); }
/** Execute a file of Python source in the local namespace */ public void execfile(String filename) { setState(); __builtin__.execfile_flags(filename, locals, locals, cflags); Py.flushLine(); }
/** Execute a Python code object in the local namespace */ public void exec(PyObject code) { setState(); Py.exec(code, locals, locals); Py.flushLine(); }
/** Execute a string of Python source in the local namespace */ public void exec(String s) { setState(); Py.exec(Py.compile_flags(s, "<string>", "exec", cflags), locals, locals); Py.flushLine(); }
/** Evaluate a string as Python source and return the result */ public PyObject eval(String s) { setState(); return __builtin__.eval(new PyString(s), locals); }
/** * Execute a file of Python source in the local namespace * * @param s the name of the file to execute */ public void execfile(String s) { setState(); __builtin__.execfile_flags(s, locals, locals, cflags); }