## org.python.core
Class Py

    java.lang.Object
      org.python.core.Py

    public final class Py

extends Object

Field Summary
`static PyObject` `ArithmeticError`
`static PyObject` `AssertionError`
`static PyObject` `AttributeError`
`static PyObject` `BaseException`
`static int` `COMMENT`
`static int` `DEBUG`
`static PySystemState` `defaultSystemState`
`static PyObject` `DeprecationWarning`
`static PyObject` `Ellipsis` The singleton Ellipsis Python object - written as ... when indexing
`static PyFrozenSet` `EmptyFrozenSet` A frozenset with zero elements
`static PyObject[]` `EmptyObjects` A zero-length array of PyObject's to pass to functions that expect zero-arguments
`static PyString` `EmptyString` A zero-length Python string
`static PyTuple` `EmptyTuple` A tuple with zero elements
`static PyObject` `EnvironmentError`
`static PyObject` `EOFError`
`static int` `ERROR`
`static PyObject` `Exception`
`static PyBoolean` `False` The Python boolean False
`static PyObject` `FloatingPointError`
`static PyObject` `FutureWarning`
`static PyObject` `GeneratorExit`
`static PyObject` `ImportError`
`static PyObject` `ImportWarning`
`static PyObject` `IndentationError`
`static PyObject` `IndexError`
`static PyObject` `IOError`
`static PyObject` `JavaError`
`static PyObject` `KeyboardInterrupt`
`static PyObject` `KeyError`
`static PyObject` `LookupError`
`static PyObject` `MemoryError`
`static int` `MESSAGE`
`static PyObject` `NameError`
`static PyString` `Newline` A Python string containing '\n'
`static Object` `NoConversion` A unique object to indicate no conversion is possible in __tojava__ methods
`static String[]` `NoKeywords` A zero-length array of Strings to pass to functions that don't have any keyword arguments
`static PyObject` `None` The singleton None Python object
`static PyObject` `NotImplemented` The singleton NotImplemented Python object.
`static PyObject` `NotImplementedError`
`static PyInteger` `One` The Python integer 1
`static PyObject` `OSError`
`static PyObject` `OverflowError`
`static PyObject` `PendingDeprecationWarning`
`static PyObject` `ReferenceError`
`static PyObject` `RuntimeError`
`static PyObject` `RuntimeWarning`
`static PyString` `Space` A Python string containing ' '
`static PyObject` `StandardError`
`static StdoutWrapper` `stderr`
`static PyObject` `StopIteration`
`static PyObject` `SyntaxError`
`static PyObject` `SyntaxWarning`
`static PyObject` `SystemError`
`static PyObject` `SystemExit`
`static PyObject` `TabError`
`static long` `TPFLAGS_BASETYPE` Set if the type allows subclassing
`static long` `TPFLAGS_HEAPTYPE` Set if the type object is dynamically allocated
`static PyBoolean` `True` The Python boolean True
`static PyObject` `TypeError`
`static PyObject` `UnboundLocalError`
`static PyObject` `UnicodeDecodeError`
`static PyObject` `UnicodeEncodeError`
`static PyObject` `UnicodeError`
`static PyObject` `UnicodeTranslateError`
`static PyObject` `UnicodeWarning`
`static PyObject` `UserWarning`
`static PyObject` `ValueError`
`static PyObject` `Warning`
`static int` `WARNING`
`static PyInteger` `Zero` The Python integer 0
`static PyObject` `ZeroDivisionError`

Method Summary
`static void` `addTraceback(Throwable t, PyFrame frame)`
`static void` `assert_(PyObject test)`
`static void` `assert_(PyObject test, PyObject message)`
`static PyException` `AssertionError(String message)`
`static PyException` `AttributeError(String message)`
`static PyObject` `compile_command_flags(String string, String filename, CompileMode kind, CompilerFlags cflags, boolean stdprompt)`
`static PyCode` `compile_flags(InputStream istream, String filename, CompileMode kind, CompilerFlags cflags)` Compiles python source code coming from a file or another external stream
`static PyCode` `compile_flags(org.python.antlr.base.mod node, String filename, CompileMode kind, CompilerFlags cflags)`
`static PyCode` `compile_flags(org.python.antlr.base.mod node, String name, String filename, boolean linenumbers, boolean printResults, CompilerFlags cflags)` Entry point for compiling modules.
`static PyCode` `compile_flags(String data, String filename, CompileMode kind, CompilerFlags cflags)` Compiles python source code coming from String (raw bytes) data.
`static PyCode` `compile(InputStream istream, String filename, CompileMode kind)`
`static void` `DeprecationWarning(String message)`
`static void` `displayException(PyObject type, PyObject value, PyObject tb, PyObject file)`
`static PyException` `EnvironmentError(String message)`
`static PyException` `EOFError(String message)`
`static void` `exec(PyObject o, PyObject globals, PyObject locals)`
`static Class<?>` `findClass(String name)` Tries to find a Java class.
`static Class<?>` `findClassEx(String name, String reason)` Tries to find a Java class.
`static PyException` `FloatingPointError(String message)`
`static void` `flushLine()`
`static String` `formatException(PyObject type, PyObject value)`
`static void` `FutureWarning(String message)`
`static PyException` `GeneratorExit(String message)`
`static ExtensiblePyObjectAdapter` `getAdapter()`
`static CompilerFlags` `getCompilerFlags()`
`static CompilerFlags` `getCompilerFlags(CompilerFlags flags, boolean dont_inherit)`
`static CompilerFlags` `getCompilerFlags(int flags, boolean dont_inherit)`
`static PyFrame` `getFrame()`
`static String` `getName()`
`static PySystemState` `getSystemState()`
`static ThreadState` `getThreadState()`
`static ThreadState` `getThreadState(PySystemState newSystemState)`
`static long` `id(PyObject o)`
`static String` `idstr(PyObject o)`
`static PyException` `ImportError(String message)`
`static void` `ImportWarning(String message)`
`static PyException` `IndexError(String message)`
`static void` `initProxy(PyProxy proxy, String module, String pyclass, Object[] args)`
`static boolean` `initPython()`
`static PyException` `IOError(com.kenai.constantine.Constant errno)`
`static PyException` `IOError(com.kenai.constantine.Constant errno, String filename)`
`static PyException` `IOError(IOException ioe)`
`static PyException` `IOError(String message)`
`static boolean` `isInstance(PyObject inst, PyObject cls)`
`static boolean` `isSubClass(PyObject derived, PyObject cls)`
`static PyObject` `iter(PyObject seq, String message)`
`static long` `java_obj_id(Object o)`
`static PyObject` `java2py(Object o)` Uses the PyObjectAdapter passed to `PySystemState.initialize()` to turn o into a PyObject.
`static PyException` `JavaError(Throwable t)`
`static PyObject[]` `javas2pys(Object... objects)` Uses the PyObjectAdapter passed to `PySystemState.initialize()` to turn `objects` into an array of PyObjects.
`static PyException` `KeyError(PyObject key)`
`static PyException` `KeyError(String message)`
`static PyString` `makeCharacter(char c)`
`static PyString` `makeCharacter(Character o)`
`static PyObject` `makeClass(String name, PyObject[] bases, PyCode code)`
`static PyObject` `makeClass(String name, PyObject[] bases, PyCode code, PyObject[] closure_cells)`
`static PyObject` `makeClass(String name, PyObject[] bases, PyObject dict)` Create a new Python class.
`static PyObject` `makeClass(String name, PyObject base, PyObject dict)`
`static PyException` `makeException()`
`static PyException` `makeException(PyObject type)`
`static PyException` `makeException(PyObject type, PyObject value)`
`static PyException` `makeException(PyObject type, PyObject value, PyObject traceback)`
`static boolean` `matchException(PyException pye, PyObject exc)` Deprecated. As of Jython 2.5, use `PyException.match(org.python.core.PyObject)` instead.
`static void` `maybeWrite(String type, String msg, int level)`
`static void` `memory_error(OutOfMemoryError t)`
`static PyException` `MemoryError(String message)`
`static PyException` `NameError(String message)`
`static PyBoolean` `newBoolean(boolean t)`
`static PyCode` `newCode(int argcount, String[] varnames, String filename, String name, boolean args, boolean keywords, PyFunctionTable funcs, int func_id)`
`static PyCode` `newCode(int argcount, String[] varnames, String filename, String name, boolean args, boolean keywords, PyFunctionTable funcs, int func_id, String[] cellvars, String[] freevars, int npurecell, int moreflags)`
`static PyCode` `newCode(int argcount, String[] varnames, String filename, String name, int firstlineno, boolean args, boolean keywords, PyFunctionTable funcs, int func_id)`
`static PyCode` `newCode(int argcount, String[] varnames, String filename, String name, int firstlineno, boolean args, boolean keywords, PyFunctionTable funcs, int func_id, String[] cellvars, String[] freevars, int npurecell, int moreflags)`
`static PyObject` `newDate(Date date)`
`static PyObject` `newDatetime(Timestamp timestamp)`
`static PyObject` `newDecimal(String decimal)`
`static PyFloat` `newFloat(double v)`
`static PyFloat` `newFloat(float v)`
`static PyComplex` `newImaginary(double v)`
`static PyInteger` `newInteger(int i)`
`static PyObject` `newInteger(long i)`
`static PyCode` `newJavaCode(Class<?> cls, String name)`
`static PyObject` `newJavaFunc(Class<?> cls, String name)`
`static PyLong` `newLong(BigInteger i)`
`static PyLong` `newLong(int i)`
`static PyLong` `newLong(long l)`
`static PyLong` `newLong(String s)`
`static PyString` `newString(char c)`
`static PyString` `newString(String s)`
`static PyStringMap` `newStringMap()`
`static PyObject` `newTime(Time time)`
`static PyUnicode` `newUnicode(char c)`
`static PyUnicode` `newUnicode(String s)`
`static PyUnicode` `newUnicode(String s, boolean isBasic)`
`static PyException` `NotImplementedError(String message)`
`static PyException` `OSError(com.kenai.constantine.Constant errno)`
`static PyException` `OSError(com.kenai.constantine.Constant errno, String filename)`
`static PyException` `OSError(IOException ioe)`
`static PyException` `OSError(String message)`
`static PyException` `OverflowError(String message)`
`static void` `PendingDeprecationWarning(String message)`
`static void` `print(PyObject o)`
`static void` `print(PyObject file, PyObject o)`
`static void` `printComma(PyObject o)`
`static void` `printComma(PyObject file, PyObject o)`
`static void` `printException(Throwable t)`
`static void` `printException(Throwable t, PyFrame f)`
`static void` `printException(Throwable t, PyFrame f, PyObject file)`
`static void` `println()`
`static void` `println(PyObject o)`
`static void` `println(PyObject file, PyObject o)`
`static void` `printlnv(PyObject file)`
`static void` `printResult(PyObject ret)`
`static boolean` `py2boolean(PyObject o)`
`static byte` `py2byte(PyObject o)`
`static char` `py2char(PyObject o)`
`static char` `py2char(PyObject o, String msg)`
`static double` `py2double(PyObject o)`
`static float` `py2float(PyObject o)`
`static int` `py2int(PyObject o)`
`static int` `py2int(PyObject o, String msg)`
`static long` `py2long(PyObject o)`
`static short` `py2short(PyObject o)`
`static void` `py2void(PyObject o)`
`static PyException` `ReferenceError(String message)`
`static PyObject` `runCode(PyCode code, PyObject locals, PyObject globals)`
`static void` `runMain(CodeBootstrap main, String[] args)` Initializes a default PythonInterpreter and runs the code loaded from the `CodeBootstrap` as __main__ Called by the code generated in `Module.addMain()`
`static void` `runMain(PyRunnable main, String[] args)` Initializes a default PythonInterpreter and runs the code from `PyRunnable.getMain()` as __main__ Called by the code generated in `Module.addMain()`
`static PyException` `RuntimeError(String message)`
`static void` `RuntimeWarning(String message)`
`static void` `saveClassFile(String name, ByteArrayOutputStream bytestream)`
`static PyException` `setException(Throwable t, PyFrame frame)`
`static void` `setFrame(PyFrame f)`
`static PySystemState` `setSystemState(PySystemState newSystemState)`
`static PyException` `StopIteration(String message)`
`static PyException` `SyntaxError(String message)`
`static void` `SyntaxWarning(String message)`
`static PyException` `SystemError(String message)`

`static

`<T> T`

`

`tojava(PyObject o, Class<T> c)`
Convert a given `PyObject` to an instance of a Java class.

`static Object` `tojava(PyObject o, String s)`
`static PyException` `TypeError(String message)`
`static PyException` `UnboundLocalError(String message)`
`static PyException` `UnicodeDecodeError(String encoding, String object, int start, int end, String reason)`
`static PyException` `UnicodeEncodeError(String encoding, String object, int start, int end, String reason)`
`static PyException` `UnicodeError(String message)`
`static PyException` `UnicodeTranslateError(String object, int start, int end, String reason)`
`static void` `UnicodeWarning(String message)`
`static PyObject[]` `unpackSequence(PyObject obj, int length)`
`static void` `UserWarning(String message)`
`static PyException` `ValueError(String message)`
`static void` `warning(PyObject category, String message)`
`static void` `warning(PyObject category, String message, String filename, int lineno, String module, PyObject registry)`
`static void` `Warning(String message)`
`static void` `writeComment(String type, String msg)`
`static void` `writeDebug(String type, String msg)`
`static void` `writeError(String type, String msg)`
`static void` `writeMessage(String type, String msg)`
`static void` `writeWarning(String type, String msg)`
`static PyException` `ZeroDivisionError(String message)`

Methods inherited from class java.lang.Object
`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### None

    public static PyObject None

  The singleton None Python object

### Ellipsis

    public static PyObject Ellipsis

  The singleton Ellipsis Python object - written as ... when indexing

### NotImplemented

    public static PyObject NotImplemented

  The singleton NotImplemented Python object. Used in rich comparison

### NoKeywords

    public static String[] NoKeywords

  A zero-length array of Strings to pass to functions that don't have any keyword arguments

### EmptyObjects

    public static PyObject[] EmptyObjects

  A zero-length array of PyObject's to pass to functions that expect zero-arguments

### EmptyFrozenSet

    public static PyFrozenSet EmptyFrozenSet

  A frozenset with zero elements

### EmptyTuple

    public static PyTuple EmptyTuple

  A tuple with zero elements

### Zero

    public static PyInteger Zero

  The Python integer 0

### One

    public static PyInteger One

  The Python integer 1

### False

    public static PyBoolean False

  The Python boolean False

### True

    public static PyBoolean True

  The Python boolean True

### EmptyString

    public static PyString EmptyString

  A zero-length Python string

### Newline

    public static PyString Newline

  A Python string containing '\n'

### Space

    public static PyString Space

  A Python string containing ' '

### TPFLAGS_HEAPTYPE

    public static long TPFLAGS_HEAPTYPE

  Set if the type object is dynamically allocated

### TPFLAGS_BASETYPE

    public static long TPFLAGS_BASETYPE

  Set if the type allows subclassing

### NoConversion

    public static Object NoConversion

  A unique object to indicate no conversion is possible in __tojava__ methods

### OSError

    public static PyObject OSError

### NotImplementedError

    public static PyObject NotImplementedError

### EnvironmentError

    public static PyObject EnvironmentError

### OverflowError

    public static PyObject OverflowError

### RuntimeError

    public static PyObject RuntimeError

### KeyboardInterrupt

    public static PyObject KeyboardInterrupt

### FloatingPointError

    public static PyObject FloatingPointError

### SyntaxError

    public static PyObject SyntaxError

### IndentationError

    public static PyObject IndentationError

### TabError

    public static PyObject TabError

### AttributeError

    public static PyObject AttributeError

### IOError

    public static PyObject IOError

### KeyError

    public static PyObject KeyError

### AssertionError

    public static PyObject AssertionError

### TypeError

    public static PyObject TypeError

### ReferenceError

    public static PyObject ReferenceError

### SystemError

    public static PyObject SystemError

### IndexError

    public static PyObject IndexError

### ZeroDivisionError

    public static PyObject ZeroDivisionError

### NameError

    public static PyObject NameError

### UnboundLocalError

    public static PyObject UnboundLocalError

### SystemExit

    public static PyObject SystemExit

### StopIteration

    public static PyObject StopIteration

### GeneratorExit

    public static PyObject GeneratorExit

### ImportError

    public static PyObject ImportError

### ValueError

    public static PyObject ValueError

### UnicodeError

    public static PyObject UnicodeError

### UnicodeTranslateError

    public static PyObject UnicodeTranslateError

### UnicodeDecodeError

    public static PyObject UnicodeDecodeError

### UnicodeEncodeError

    public static PyObject UnicodeEncodeError

### EOFError

    public static PyObject EOFError

### MemoryError

    public static PyObject MemoryError

### ArithmeticError

    public static PyObject ArithmeticError

### LookupError

    public static PyObject LookupError

### StandardError

    public static PyObject StandardError

### Exception

    public static PyObject Exception

### BaseException

    public static PyObject BaseException

### Warning

    public static PyObject Warning

### UserWarning

    public static PyObject UserWarning

### DeprecationWarning

    public static PyObject DeprecationWarning

### PendingDeprecationWarning

    public static PyObject PendingDeprecationWarning

### SyntaxWarning

    public static PyObject SyntaxWarning

### RuntimeWarning

    public static PyObject RuntimeWarning

### FutureWarning

    public static PyObject FutureWarning

### ImportWarning

    public static PyObject ImportWarning

### UnicodeWarning

    public static PyObject UnicodeWarning

### JavaError

    public static PyObject JavaError

### defaultSystemState

    public static volatile PySystemState defaultSystemState

### stderr

    public static StdoutWrapper stderr

### ERROR

    public static final int ERROR

See Also:
  Constant Field Values

### WARNING

    public static final int WARNING

See Also:
  Constant Field Values

### MESSAGE

    public static final int MESSAGE

See Also:
  Constant Field Values

### COMMENT

    public static final int COMMENT

See Also:
  Constant Field Values

### DEBUG

    public static final int DEBUG

See Also:
  Constant Field Values

Method Detail

### OSError

    public static PyException OSError(String message)

### OSError

    public static PyException OSError(IOException ioe)

### OSError

    public static PyException OSError(com.kenai.constantine.Constant errno)

### OSError

    public static PyException OSError(com.kenai.constantine.Constant errno,
                                      String filename)

### NotImplementedError

    public static PyException NotImplementedError(String message)

### EnvironmentError

    public static PyException EnvironmentError(String message)

### OverflowError

    public static PyException OverflowError(String message)

### RuntimeError

    public static PyException RuntimeError(String message)

### FloatingPointError

    public static PyException FloatingPointError(String message)

### SyntaxError

    public static PyException SyntaxError(String message)

### AttributeError

    public static PyException AttributeError(String message)

### IOError

    public static PyException IOError(IOException ioe)

### IOError

    public static PyException IOError(String message)

### IOError

    public static PyException IOError(com.kenai.constantine.Constant errno)

### IOError

    public static PyException IOError(com.kenai.constantine.Constant errno,
                                      String filename)

### KeyError

    public static PyException KeyError(String message)

### KeyError

    public static PyException KeyError(PyObject key)

### AssertionError

    public static PyException AssertionError(String message)

### TypeError

    public static PyException TypeError(String message)

### ReferenceError

    public static PyException ReferenceError(String message)

### SystemError

    public static PyException SystemError(String message)

### IndexError

    public static PyException IndexError(String message)

### ZeroDivisionError

    public static PyException ZeroDivisionError(String message)

### NameError

    public static PyException NameError(String message)

### UnboundLocalError

    public static PyException UnboundLocalError(String message)

### StopIteration

    public static PyException StopIteration(String message)

### GeneratorExit

    public static PyException GeneratorExit(String message)

### ImportError

    public static PyException ImportError(String message)

### ValueError

    public static PyException ValueError(String message)

### UnicodeError

    public static PyException UnicodeError(String message)

### UnicodeTranslateError

    public static PyException UnicodeTranslateError(String object,
                                                    int start,
                                                    int end,
                                                    String reason)

### UnicodeDecodeError

    public static PyException UnicodeDecodeError(String encoding,
                                                 String object,
                                                 int start,
                                                 int end,
                                                 String reason)

### UnicodeEncodeError

    public static PyException UnicodeEncodeError(String encoding,
                                                 String object,
                                                 int start,
                                                 int end,
                                                 String reason)

### EOFError

    public static PyException EOFError(String message)

### memory_error

    public static void memory_error(OutOfMemoryError t)

### MemoryError

    public static PyException MemoryError(String message)

### Warning

    public static void Warning(String message)

### UserWarning

    public static void UserWarning(String message)

### DeprecationWarning

    public static void DeprecationWarning(String message)

### PendingDeprecationWarning

    public static void PendingDeprecationWarning(String message)

### SyntaxWarning

    public static void SyntaxWarning(String message)

### RuntimeWarning

    public static void RuntimeWarning(String message)

### FutureWarning

    public static void FutureWarning(String message)

### ImportWarning

    public static void ImportWarning(String message)

### UnicodeWarning

    public static void UnicodeWarning(String message)

### warning

    public static void warning(PyObject category,
                               String message)

### warning

    public static void warning(PyObject category,
                               String message,
                               String filename,
                               int lineno,
                               String module,
                               PyObject registry)

### JavaError

    public static PyException JavaError(Throwable t)

### tojava

    public static <T> T tojava(PyObject o,
                               Class<T> c)

  Convert a given `PyObject` to an instance of a Java class. Identical to `o.__tojava__(c)` except that it will raise a `TypeError` if the conversion fails.

  Parameters:
    `o` - the `PyObject` to convert.
    `c` - the class to convert it to.

### tojava

    public static Object tojava(PyObject o,
                                String s)

### newInteger

    public static final PyInteger newInteger(int i)

### newInteger

    public static PyObject newInteger(long i)

### newLong

    public static PyLong newLong(String s)

### newLong

    public static PyLong newLong(BigInteger i)

### newLong

    public static PyLong newLong(int i)

### newLong

    public static PyLong newLong(long l)

### newImaginary

    public static PyComplex newImaginary(double v)

### newFloat

    public static PyFloat newFloat(float v)

### newFloat

    public static PyFloat newFloat(double v)

### newString

    public static PyString newString(char c)

### newString

    public static PyString newString(String s)

### newStringMap

    public static PyStringMap newStringMap()

### newUnicode

    public static PyUnicode newUnicode(char c)

### newUnicode

    public static PyUnicode newUnicode(String s)

### newUnicode

    public static PyUnicode newUnicode(String s,
                                       boolean isBasic)

### newBoolean

    public static PyBoolean newBoolean(boolean t)

### newDate

    public static PyObject newDate(Date date)

### newTime

    public static PyObject newTime(Time time)

### newDatetime

    public static PyObject newDatetime(Timestamp timestamp)

### newDecimal

    public static PyObject newDecimal(String decimal)

### newCode

    public static PyCode newCode(int argcount,
                                 String[] varnames,
                                 String filename,
                                 String name,
                                 boolean args,
                                 boolean keywords,
                                 PyFunctionTable funcs,
                                 int func_id,
                                 String[] cellvars,
                                 String[] freevars,
                                 int npurecell,
                                 int moreflags)

### newCode

    public static PyCode newCode(int argcount,
                                 String[] varnames,
                                 String filename,
                                 String name,
                                 int firstlineno,
                                 boolean args,
                                 boolean keywords,
                                 PyFunctionTable funcs,
                                 int func_id,
                                 String[] cellvars,
                                 String[] freevars,
                                 int npurecell,
                                 int moreflags)

### newCode

    public static PyCode newCode(int argcount,
                                 String[] varnames,
                                 String filename,
                                 String name,
                                 boolean args,
                                 boolean keywords,
                                 PyFunctionTable funcs,
                                 int func_id)

### newCode

    public static PyCode newCode(int argcount,
                                 String[] varnames,
                                 String filename,
                                 String name,
                                 int firstlineno,
                                 boolean args,
                                 boolean keywords,
                                 PyFunctionTable funcs,
                                 int func_id)

### newJavaCode

    public static PyCode newJavaCode(Class<?> cls,
                                     String name)

### newJavaFunc

    public static PyObject newJavaFunc(Class<?> cls,
                                       String name)

### initPython

    public static boolean initPython()

### findClass

    public static Class<?> findClass(String name)

  Tries to find a Java class.

  Parameters:
    `name` - Name of the Java class.
  Returns:
    The class, or null if it wasn't found

### findClassEx

    public static Class<?> findClassEx(String name,
                                       String reason)

  Tries to find a Java class. Unless `findClass(String)`, it raises a JavaError if the class was found but there were problems loading it.

  Parameters:
    `name` - Name of the Java class.
    `reason` - Reason for finding the class. Used for debugging messages.
  Returns:
    The class, or null if it wasn't found
  Throws:
    `JavaError` - wrapping LinkageErrors/IllegalArgumentExceptions occurred when the class is found but can't be loaded.

### initProxy

    public static void initProxy(PyProxy proxy,
                                 String module,
                                 String pyclass,
                                 Object[] args)

### runMain

    public static void runMain(PyRunnable main,
                               String[] args)
                        throws Exception

  Initializes a default PythonInterpreter and runs the code from `PyRunnable.getMain()` as __main__ Called by the code generated in `Module.addMain()`

  Throws:
    `Exception`

### runMain

    public static void runMain(CodeBootstrap main,
                               String[] args)
                        throws Exception

  Initializes a default PythonInterpreter and runs the code loaded from the `CodeBootstrap` as __main__ Called by the code generated in `Module.addMain()`

  Throws:
    `Exception`

### printException

    public static void printException(Throwable t)

### printException

    public static void printException(Throwable t,
                                      PyFrame f)

### printException

    public static void printException(Throwable t,
                                      PyFrame f,
                                      PyObject file)

### displayException

    public static void displayException(PyObject type,
                                        PyObject value,
                                        PyObject tb,
                                        PyObject file)

### formatException

    public static String formatException(PyObject type,
                                         PyObject value)

### assert_

    public static void assert_(PyObject test,
                               PyObject message)

### assert_

    public static void assert_(PyObject test)

### addTraceback

    public static void addTraceback(Throwable t,
                                    PyFrame frame)

### setException

    public static PyException setException(Throwable t,
                                           PyFrame frame)

### matchException

    @Deprecated
    public static boolean matchException(PyException pye,
                                                    PyObject exc)

  Deprecated. As of Jython 2.5, use `PyException.match(org.python.core.PyObject)` instead.

### makeException

    public static PyException makeException(PyObject type,
                                            PyObject value,
                                            PyObject traceback)

### makeException

    public static PyException makeException(PyObject type,
                                            PyObject value)

### makeException

    public static PyException makeException(PyObject type)

### makeException

    public static PyException makeException()

### runCode

    public static PyObject runCode(PyCode code,
                                   PyObject locals,
                                   PyObject globals)

### exec

    public static void exec(PyObject o,
                            PyObject globals,
                            PyObject locals)

### getThreadState

    public static final ThreadState getThreadState()

### getThreadState

    public static final ThreadState getThreadState(PySystemState newSystemState)

### setSystemState

    public static final PySystemState setSystemState(PySystemState newSystemState)

### getSystemState

    public static final PySystemState getSystemState()

### getFrame

    public static PyFrame getFrame()

### setFrame

    public static void setFrame(PyFrame f)

### print

    public static void print(PyObject file,
                             PyObject o)

### printComma

    public static void printComma(PyObject file,
                                  PyObject o)

### println

    public static void println(PyObject file,
                               PyObject o)

### printlnv

    public static void printlnv(PyObject file)

### print

    public static void print(PyObject o)

### printComma

    public static void printComma(PyObject o)

### println

    public static void println(PyObject o)

### println

    public static void println()

### flushLine

    public static void flushLine()

### py2boolean

    public static boolean py2boolean(PyObject o)

### py2byte

    public static byte py2byte(PyObject o)

### py2short

    public static short py2short(PyObject o)

### py2int

    public static int py2int(PyObject o)

### py2int

    public static int py2int(PyObject o,
                             String msg)

### py2long

    public static long py2long(PyObject o)

### py2float

    public static float py2float(PyObject o)

### py2double

    public static double py2double(PyObject o)

### py2char

    public static char py2char(PyObject o)

### py2char

    public static char py2char(PyObject o,
                               String msg)

### py2void

    public static void py2void(PyObject o)

### makeCharacter

    public static final PyString makeCharacter(Character o)

### makeCharacter

    public static final PyString makeCharacter(char c)

### java2py

    public static PyObject java2py(Object o)

  Uses the PyObjectAdapter passed to `PySystemState.initialize()` to turn o into a PyObject.

  See Also:
    `- default PyObjectAdapter type`

### javas2pys

    public static PyObject[] javas2pys(Object... objects)

  Uses the PyObjectAdapter passed to `PySystemState.initialize()` to turn `objects` into an array of PyObjects.

  See Also:
    `- default PyObjectAdapter type`

### getAdapter

    public static ExtensiblePyObjectAdapter getAdapter()

  Returns:
    the ExtensiblePyObjectAdapter used by java2py.

### makeClass

    public static PyObject makeClass(String name,
                                     PyObject[] bases,
                                     PyCode code)

### makeClass

    public static PyObject makeClass(String name,
                                     PyObject[] bases,
                                     PyCode code,
                                     PyObject[] closure_cells)

### makeClass

    public static PyObject makeClass(String name,
                                     PyObject base,
                                     PyObject dict)

### makeClass

    public static PyObject makeClass(String name,
                                     PyObject[] bases,
                                     PyObject dict)

  Create a new Python class.

  Parameters:
    `name` - the String name of the class
    `bases` - an array of PyObject base classes
    `dict` - the class's namespace, containing the class body definition
  Returns:
    a new Python Class PyObject

### getName

    public static String getName()

### getCompilerFlags

    public static CompilerFlags getCompilerFlags()

### getCompilerFlags

    public static CompilerFlags getCompilerFlags(int flags,
                                                 boolean dont_inherit)

### getCompilerFlags

    public static CompilerFlags getCompilerFlags(CompilerFlags flags,
                                                 boolean dont_inherit)

### compile

    public static PyCode compile(InputStream istream,
                                 String filename,
                                 CompileMode kind)

### compile_flags

    public static PyCode compile_flags(org.python.antlr.base.mod node,
                                       String name,
                                       String filename,
                                       boolean linenumbers,
                                       boolean printResults,
                                       CompilerFlags cflags)

  Entry point for compiling modules.

  Parameters:
    `node` - Module node, coming from the parsing process
    `name` - Internal name for the compiled code. Typically generated by calling `getName()`.
    `filename` - Source file name
    `linenumbers` - True to track source line numbers on the generated code
    `printResults` - True to call the sys.displayhook on the result of the code
    `cflags` - Compiler flags
  Returns:
    Code object for the compiled module

### compile_flags

    public static PyCode compile_flags(org.python.antlr.base.mod node,
                                       String filename,
                                       CompileMode kind,
                                       CompilerFlags cflags)

### compile_flags

    public static PyCode compile_flags(InputStream istream,
                                       String filename,
                                       CompileMode kind,
                                       CompilerFlags cflags)

  Compiles python source code coming from a file or another external stream

### compile_flags

    public static PyCode compile_flags(String data,
                                       String filename,
                                       CompileMode kind,
                                       CompilerFlags cflags)

  Compiles python source code coming from String (raw bytes) data. If the String is properly decoded (from PyUnicode) the PyCF_SOURCE_IS_UTF8 flag should be specified.

### compile_command_flags

    public static PyObject compile_command_flags(String string,
                                                 String filename,
                                                 CompileMode kind,
                                                 CompilerFlags cflags,
                                                 boolean stdprompt)

### unpackSequence

    public static PyObject[] unpackSequence(PyObject obj,
                                            int length)

### iter

    public static PyObject iter(PyObject seq,
                                String message)

### id

    public static long id(PyObject o)

### idstr

    public static String idstr(PyObject o)

### java_obj_id

    public static long java_obj_id(Object o)

### printResult

    public static void printResult(PyObject ret)

### maybeWrite

    public static void maybeWrite(String type,
                                  String msg,
                                  int level)

### writeError

    public static void writeError(String type,
                                  String msg)

### writeWarning

    public static void writeWarning(String type,
                                    String msg)

### writeMessage

    public static void writeMessage(String type,
                                    String msg)

### writeComment

    public static void writeComment(String type,
                                    String msg)

### writeDebug

    public static void writeDebug(String type,
                                  String msg)

### saveClassFile

    public static void saveClassFile(String name,
                                     ByteArrayOutputStream bytestream)

### isInstance

    public static boolean isInstance(PyObject inst,
                                     PyObject cls)

### isSubClass

    public static boolean isSubClass(PyObject derived,
                                     PyObject cls)

Jython homepage