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
PyExceptionon failure.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classPython.PlatformProvides information needed to start Python.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description PyObjectgetBuiltins()Returns thebuiltinsmodule.static PythongetInstance()Gets the interface to Python.PyObjectgetModule(String name)Returns the Python module with the given name.static Python.PlatformgetPlatform()Returns the Platform object which was used to start Python, ornullifstarthas not been called.static booleanisStarted()Returns whether Python is running.static voidstart(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, ornullifstarthas 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).
-
-