| Modifier and Type | Field and Description |
|---|---|
| protected CompilerFlags | |
| private volatile boolean | |
| pack-priv PyObject | |
| protected PySystemState | |
| protected static ThreadLocal | |
| protected final boolean |
| Access | Constructor and Description |
|---|---|
| public | |
| public | PythonInterpreter(PyObject
a Python mapping object (e.g., a dictionary) for use as the namespace dict)Creates a new interpreter with a specified local namespace. |
| public | |
| protected |
| Modifier and Type | Method and Description |
|---|---|
| public void | |
| public void | close()
Implements java. Closes this resource, relinquishing any underlying resources. |
| public PyCode | |
| public PyCode | |
| public PyCode | |
| public PyCode | |
| public PyObject | |
| public PyObject | |
| public void | |
| public void | |
| public void | |
| public void | |
| public void | |
| public PyObject | |
| public <T> T | |
| public PyObject | |
| public PySystemState | |
| public static void | initialize(Properties
A set of properties. Typically System.getProperties() is used.
preProperties override properties from the registry file. preProperties, Properties Another set of properties. Values like python.home, python.path and all
other values from the registry files can be added to this property set.
postProperties override system properties and registry properties. postProperties, String[] Command line arguments, assigned to sys.argv. argv)Initializes the Jython runtime. |
| public void | |
| public void | |
| public void | |
| public void | setErr(Writer
to use as the error output stream outStream)Sets a |
| public void | |
| public void | |
| public void | |
| public void | setIn(InputStream
InputStream to use as input stream inStream)Sets a |
| public void | |
| public void | |
| public void | setOut(Writer
to use as the output stream outStream)Sets a |
| public void | setOut(OutputStream
OutputStream to use as output stream outStream)Sets a |
| protected void | |
| public static PythonInterpreter | threadLocalStateInterpreter(PyObject
a Python mapping object (e.g., a dictionary) for use as the default namespace dict)Creates a new interpreter with the ability to maintain a separate local namespace for each thread (set by invoking setLocals()). |
| cflags | back to summary |
|---|---|
| protected CompilerFlags cflags | |
| closed | back to summary |
|---|---|
| private volatile boolean closed | |
| globals | back to summary |
|---|---|
| pack-priv PyObject globals | |
| systemState | back to summary |
|---|---|
| protected PySystemState systemState | |
| threadLocals | back to summary |
|---|---|
| protected static ThreadLocal<Object[]> threadLocals | |
| useThreadLocalState | back to summary |
|---|---|
| protected final boolean useThreadLocalState | |
| PythonInterpreter | back to summary |
|---|---|
| public PythonInterpreter() Creates a new interpreter with an empty local namespace. | |
| PythonInterpreter | back to summary |
|---|---|
| public PythonInterpreter(PyObject dict) Creates a new interpreter with a specified local namespace.
| |
| PythonInterpreter | back to summary |
|---|---|
| public PythonInterpreter(PyObject dict, PySystemState systemState) | |
| PythonInterpreter | back to summary |
|---|---|
| protected PythonInterpreter(PyObject dict, PySystemState systemState, boolean useThreadLocalState) | |
| cleanup | back to summary |
|---|---|
| public void cleanup() | |
| close | back to summary |
|---|---|
| public void close() Implements java. Doc from java. Closes this resource, relinquishing any underlying resources.
This method is invoked automatically on objects managed by the
| |
| compile | back to summary |
|---|---|
| public PyCode compile(String script) Compiles a string of Python source as either an expression (if possible) or a module. Designed for use by a JSR 223 implementation: "the Scripting API does not distinguish between scripts which return values and those which do not, nor do they make the corresponding distinction between evaluating or executing objects." (SCR.4.2.1) | |
| compile | back to summary |
|---|---|
| public PyCode compile(Reader reader) | |
| compile | back to summary |
|---|---|
| public PyCode compile(String script, String filename) | |
| compile | back to summary |
|---|---|
| public PyCode compile(Reader reader, String filename) | |
| eval | back to summary |
|---|---|
| public PyObject eval(String s) Evaluates a string as a Python expression and returns the result. | |
| eval | back to summary |
|---|---|
| public PyObject eval(PyObject code) Evaluates a Python code object and returns the result. | |
| exec | back to summary |
|---|---|
| public void exec(String s) Executes a string of Python source in the local namespace. In some environments, such as Windows, Unicode characters in the script will be converted into ascii question marks (?). This can be avoided by first compiling the fragment using PythonInterpreter.compile(), and using the overridden form of this method which takes a PyCode object. Code page declarations are not supported. | |
| exec | back to summary |
|---|---|
| public void exec(PyObject code) Executes a Python code object in the local namespace. | |
| execfile | back to summary |
|---|---|
| public void execfile(String filename) Executes a file of Python source in the local namespace. | |
| execfile | back to summary |
|---|---|
| public void execfile(InputStream s) | |
| execfile | back to summary |
|---|---|
| public void execfile(InputStream s, String name) | |
| get | back to summary |
|---|---|
| public PyObject get(String name) Returns the value of a variable in the local namespace. | |
| get | back to summary |
|---|---|
| public <T> T get(String name, Class<T> javaclass) Returns the value of a variable in the local namespace.
The value will be returned as an instance of the given Java class.
the value of the variable as the given class, or null if that name isn't assigned | |
| getLocals | back to summary |
|---|---|
| public PyObject getLocals() | |
| getSystemState | back to summary |
|---|---|
| public PySystemState getSystemState() | |
| initialize | back to summary |
|---|---|
| public static void initialize(Properties preProperties, Properties postProperties, String[] argv) Initializes the Jython runtime. This should only be called once, before any other Python objects (including PythonInterpreter) are created.
| |
| set | back to summary |
|---|---|
| public void set(String name, Object value) Sets a variable in the local namespace. | |
| set | back to summary |
|---|---|
| public void set(String name, PyObject value) Sets a variable in the local namespace. | |
| setErr | back to summary |
|---|---|
| public void setErr(PyObject outStream) Sets a Python object to use for the standard output stream,
| |
| setErr | back to summary |
|---|---|
| public void setErr(Writer outStream) Sets a
| |
| setErr | back to summary |
|---|---|
| public void setErr(OutputStream outStream) | |
| setIn | back to summary |
|---|---|
| public void setIn(PyObject inStream) Sets a Python object to use for the standard input stream,
| |
| setIn | back to summary |
|---|---|
| public void setIn(Reader inStream) Sets a
| |
| setIn | back to summary |
|---|---|
| public void setIn(InputStream inStream) Sets a
| |
| setLocals | back to summary |
|---|---|
| public void setLocals(PyObject d) | |
| setOut | back to summary | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| public void setOut(PyObject outStream) Sets a Python object to use for the standard output stream,
| |||||||||||||||||||||
| setOut | back to summary |
|---|---|
| public void setOut(Writer outStream) Sets a
| |
| setOut | back to summary |
|---|---|
| public void setOut(OutputStream outStream) Sets a
| |
| setSystemState | back to summary |
|---|---|
| protected void setSystemState() | |
| threadLocalStateInterpreter | back to summary |
|---|---|
| public static PythonInterpreter threadLocalStateInterpreter(PyObject dict) Creates a new interpreter with the ability to maintain a separate local namespace for each thread (set by invoking setLocals()).
| |