org.python.core

Class PySystemState

Implemented Interfaces:
java.io.Serializable

public class PySystemState
extends PyObject

The "sys" module.
See Also:
Serialized Form

Nested Class Summary

Nested classes/interfaces inherited from class org.python.core.PyObject

PyObject.ConversionException

Field Summary

static String
JYTHON_JAR
PyObject
__dict__
PyObject
__displayhook__
PyObject
__excepthook__
PyObject
__stderr__
PyObject
__stdin__
PyObject
__stdout__
PyList
argv
The arguments passed to this program on the command line.
static String[]
builtin_module_names
static PyObject
builtins
static String
byteorder
static File
cachedir
static String
copyright
The copyright notice for this release.
static String
exec_prefix
PyObject
executable
static int
hexversion
PyObject
last_traceback
PyObject
last_type
PyObject
last_value
static int
maxint
static int
maxunicode
PyList
meta_path
static int
minint
PyObject
modules
static PackageManager
packageManager
PyList
path
PyList
path_hooks
PyObject
path_importer_cache
static String
platform
static String
prefix
TraceFunction
profilefunc
PyObject
ps1
PyObject
ps2
static Properties
registry
PyObject
stderr
PyObject
stdin
PyObject
stdout
TraceFunction
tracefunc
static String
version
The current version of Jython.
static PyTuple
version_info
static PyList
warnoptions

Fields inherited from class org.python.core.PyObject

exposed_name

Constructor Summary

PySystemState()
The standard constructor for a PyObject.

Method Summary

void
__delattr__(String name)
A variant of the __delattr__ method which accepts a String as the key.
PyObject
__findattr__(String name)
A variant of the __findattr__ method which accepts a Java String as the name.
void
__rawdir__(PyDictionary accum)
void
__setattr__(String name, PyObject value)
A variant of the __setattr__ method which accepts a String as the key.
static PyFrame
_getframe()
static PyFrame
_getframe(int depth)
static void
add_classdir(String directoryPath)
Add a classpath directory to the list of places that are searched for java packages.
static void
add_extdir(String directoryPath)
Add a .jar & .zip directory to the list of places that are searched for java .jar and .zip files.
static void
add_extdir(String directoryPath, boolean cache)
Add a .jar & .zip directory to the list of places that are searched for java .jar and .zip files.
static PyJavaPackage
add_package(String n)
static PyJavaPackage
add_package(String n, String contents)
void
callExitFunc()
static void
determinePlatform(Properties props)
static PyTuple
exc_info()
static void
exit()
Exit a Python program with the status 0.
static void
exit(PyObject status)
Exit a Python program with the given status.
static Properties
getBaseProperties()
ClassLoader
getClassLoader()
String
getdefaultencoding()
int
getrecursionlimit()
static void
initialize()
static void
initialize(Properties preProperties, Properties postProperties, String[] argv)
static void
initialize(Properties preProperties, Properties postProperties, String[] argv, ClassLoader classLoader)
static void
initialize(Properties preProperties, Properties postProperties, String[] argv, ClassLoader classLoader, org.python.core.adapter.ExtensiblePyObjectAdapter adapter)
static boolean
isPackageCacheEnabled()
String
safeRepr()
void
setClassLoader(ClassLoader classLoader)
void
setdefaultencoding(String encoding)
void
setprofile(PyObject profilefunc)
void
setrecursionlimit(int recursionlimit)
void
settrace(PyObject tracefunc)
String
toString()

Methods inherited from class org.python.core.PyObject

__abs__, __add__, __and__, __call__, __call__, __call__, __call__, __call__, __call__, __call__, __call__, __cmp__, __coerce__, __coerce_ex__, __complex__, __contains__, __delattr__, __delattr__, __delete__, __delitem__, __delitem__, __delslice__, __delslice__, __dir__, __div__, __divmod__, __eq__, __findattr__, __findattr__, __finditem__, __finditem__, __finditem__, __float__, __floordiv__, __ge__, __get__, __getattr__, __getattr__, __getitem__, __getitem__, __getnewargs__, __getslice__, __getslice__, __gt__, __hash__, __hex__, __iadd__, __iand__, __idiv__, __idivmod__, __ifloordiv__, __ilshift__, __imod__, __imul__, __int__, __invert__, __ior__, __ipow__, __irshift__, __isub__, __iter__, __iternext__, __itruediv__, __ixor__, __le__, __len__, __long__, __lshift__, __lt__, __mod__, __mul__, __ne__, __neg__, __nonzero__, __not__, __oct__, __or__, __pos__, __pow__, __pow__, __radd__, __rand__, __rdiv__, __rdivmod__, __reduce__, __repr__, __rfloordiv__, __rlshift__, __rmod__, __rmul__, __ror__, __rpow__, __rrshift__, __rshift__, __rsub__, __rtruediv__, __rxor__, __set__, __setattr__, __setattr__, __setitem__, __setitem__, __setitem__, __setslice__, __setslice__, __str__, __sub__, __tojava__, __truediv__, __unicode__, __xor__, _add, _and, _callextra, _cmp, _div, _divmod, _doget, _doget, _doset, _eq, _floordiv, _ge, _gt, _in, _is, _isnot, _jcall, _jcallexc, _jthrow, _le, _lshift, _lt, _mod, _mul, _ne, _notin, _or, _pow, _rshift, _sub, _truediv, _xor, asInt, asLong, asName, asString, asStringOrNull, delDict, delType, dispatch__init__, equals, fastGetClass, fastGetDict, getDict, getDoc, getType, hashCode, implementsDescrDelete, implementsDescrSet, invoke, invoke, invoke, invoke, invoke, isCallable, isDataDescr, isMappingType, isNumberType, isSequenceType, noAttributeError, readonlyAttributeError, safeRepr, setDict, setType, toString, typeSetup

Field Details

JYTHON_JAR

public static final String JYTHON_JAR

__dict__

public PyObject __dict__

__displayhook__

public PyObject __displayhook__

__excepthook__

public PyObject __excepthook__

__stderr__

public PyObject __stderr__

__stdin__

public PyObject __stdin__

__stdout__

public PyObject __stdout__

argv

public PyList argv
The arguments passed to this program on the command line.

builtin_module_names

public static String[] builtin_module_names

builtins

public static PyObject builtins

byteorder

public static String byteorder

cachedir

public static File cachedir

copyright

public static String copyright
The copyright notice for this release.

exec_prefix

public static String exec_prefix

executable

public PyObject executable

hexversion

public static int hexversion

last_traceback

public PyObject last_traceback

last_type

public PyObject last_type

last_value

public PyObject last_value

maxint

public static int maxint

maxunicode

public static int maxunicode

meta_path

public PyList meta_path

minint

public static int minint

modules

public PyObject modules

packageManager

public static PackageManager packageManager

path

public PyList path

path_hooks

public PyList path_hooks

path_importer_cache

public PyObject path_importer_cache

platform

public static String platform

prefix

public static String prefix

profilefunc

public TraceFunction profilefunc

ps1

public PyObject ps1

ps2

public PyObject ps2

registry

public static Properties registry

stderr

public PyObject stderr

stdin

public PyObject stdin

stdout

public PyObject stdout

tracefunc

public TraceFunction tracefunc

version

public static String version
The current version of Jython.

Usually updated by hand.
Replaced by ant when doing a snapshot build.

This also applies for the PY_* integer values below


version_info

public static PyTuple version_info

warnoptions

public static PyList warnoptions

Constructor Details

PySystemState

public PySystemState()
The standard constructor for a PyObject. It will set the __class__ field to correspond to the specific subclass of PyObject being instantiated.

Method Details

__delattr__

public void __delattr__(String name)
A variant of the __delattr__ method which accepts a String as the key. This String must be interned. By default, this will call __delattr__(PyString name) with the appropriate args. The only reason to override this method is for performance.
Overrides:
__delattr__ in interface PyObject
Parameters:
name - the name which will be removed - must be an interned string .

__findattr__

public PyObject __findattr__(String name)
A variant of the __findattr__ method which accepts a Java String as the name. Warning: name must be an interned string!
Overrides:
__findattr__ in interface PyObject
Parameters:
name - the name to lookup in this namespace must be an interned string .
Returns:
the value corresponding to name or null if name is not found

__rawdir__

public void __rawdir__(PyDictionary accum)

__setattr__

public void __setattr__(String name,
                        PyObject value)
A variant of the __setattr__ method which accepts a String as the key. This String must be interned.
Overrides:
__setattr__ in interface PyObject
Parameters:
name - the name whose value will be set - must be an interned string .
value - the value to set this name to

_getframe

public static PyFrame _getframe()

_getframe

public static PyFrame _getframe(int depth)

add_classdir

public static void add_classdir(String directoryPath)
Add a classpath directory to the list of places that are searched for java packages.

Note. Classes found in directory and subdirectory are not made available to jython by this call. It only makes the java package found in the directory available. This call is mostly usefull if jython is embedded in an application that deals with its own classloaders. A servlet container is a very good example. Calling add_classdir("/WEB-INF/classes") makes the java packages in WEB-INF classes available to jython import. However the actual classloading is completely handled by the servlet container's context classloader.


add_extdir

public static void add_extdir(String directoryPath)
Add a .jar & .zip directory to the list of places that are searched for java .jar and .zip files. The .jar and .zip files found will not be cached.

Note. Classes in .jar and .zip files found in the directory are not made available to jython by this call. See the note for add_classdir(dir) for more details.

Parameters:
directoryPath - The name of a directory.

add_extdir

public static void add_extdir(String directoryPath,
                              boolean cache)
Add a .jar & .zip directory to the list of places that are searched for java .jar and .zip files.

Note. Classes in .jar and .zip files found in the directory are not made available to jython by this call. See the note for add_classdir(dir) for more details.

Parameters:
directoryPath - The name of a directory.
cache - Controls if the packages in the zip and jar file should be cached.

add_package

public static PyJavaPackage add_package(String n)

add_package

public static PyJavaPackage add_package(String n,
                                        String contents)

callExitFunc

public void callExitFunc()
            throws PyIgnoreMethodTag

determinePlatform

public static void determinePlatform(Properties props)

exc_info

public static PyTuple exc_info()

exit

public static void exit()
Exit a Python program with the status 0.

exit

public static void exit(PyObject status)
Exit a Python program with the given status.
Parameters:
status - the value to exit with

getBaseProperties

public static Properties getBaseProperties()

getClassLoader

public ClassLoader getClassLoader()

getdefaultencoding

public String getdefaultencoding()

getrecursionlimit

public int getrecursionlimit()

initialize

public static void initialize()

initialize

public static void initialize(Properties preProperties,
                              Properties postProperties,
                              String[] argv)

initialize

public static void initialize(Properties preProperties,
                              Properties postProperties,
                              String[] argv,
                              ClassLoader classLoader)

initialize

public static void initialize(Properties preProperties,
                              Properties postProperties,
                              String[] argv,
                              ClassLoader classLoader,
                              org.python.core.adapter.ExtensiblePyObjectAdapter adapter)

isPackageCacheEnabled

public static boolean isPackageCacheEnabled()

safeRepr

public String safeRepr()
            throws PyIgnoreMethodTag
Overrides:
safeRepr in interface PyObject

setClassLoader

public void setClassLoader(ClassLoader classLoader)

setdefaultencoding

public void setdefaultencoding(String encoding)

setprofile

public void setprofile(PyObject profilefunc)

setrecursionlimit

public void setrecursionlimit(int recursionlimit)

settrace

public void settrace(PyObject tracefunc)

toString

public String toString()
Overrides:
toString in interface PyObject

Jython homepage