public class Python extends Object
Interface to Python.
Unless otherwise specified, all methods in this class throw PyException on
failure.
| Modifier and Type | Class and Description |
|---|---|
static class |
Python.Platform
Provides information needed to start Python.
|
| Modifier and Type | Method and Description |
|---|---|
PyObject |
getBuiltins()
Returns the
builtins module. |
static Python |
getInstance()
Gets the interface to Python.
|
PyObject |
getModule(String name)
Returns the Python module with the given name.
|
static Python.Platform |
getPlatform()
Returns the Platform object which was used to start Python, or
null if start has not been called. |
static boolean |
isStarted()
Returns whether Python is running.
|
static void |
start(Python.Platform platform)
Starts Python.
|
@NotNull public PyObject getBuiltins()
builtins module. This contains Python's built-in functions (e.g. open),
types (e.g. dict), constants (e.g. True) and exceptions (e.g. ValueError).@NotNull public static Python getInstance()
start() has not yet been called, it will be called with a new
GenericPlatform.@NotNull public PyObject getModule(@NotNull String name)
os.path).public static Python.Platform getPlatform()
null if start has not been called.public static boolean isStarted()
public static void start(@NotNull
Python.Platform platform)
Starts Python. If this method is called, it can only be called once, and it must be
before any call to getInstance().
If running on Android, make sure you read the notes on how to call this method in your app.