Package com.chaquo.python
Class Python
- java.lang.Object
-
- com.chaquo.python.Python
-
public class Python extends Object
Interface to Python.
Unless otherwise specified, all methods in this class throw
PyException
on failure.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Python.Platform
Provides information needed to start Python.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description PyObject
getBuiltins()
Returns thebuiltins
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, ornull
ifstart
has not been called.static boolean
isStarted()
Returns whether Python is running.static void
start(Python.Platform platform)
Starts Python.
-
-
-
Method Detail
-
getInstance
@NotNull public static Python getInstance()
Gets the interface to Python. This method always returns the same object. Ifstart()
has not yet been called, it will be called with a newGenericPlatform
.
-
start
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.
-
getPlatform
public static Python.Platform getPlatform()
Returns the Platform object which was used to start Python, ornull
ifstart
has not been called.
-
isStarted
public static boolean isStarted()
Returns whether Python is running.
-
getModule
@NotNull public PyObject getModule(@NotNull String name)
Returns the Python module with the given name. Dot notation may be used to get submodules (e.g.os.path
).
-
-