org.python.core
Class PySystemState

java.lang.Object
  extended by org.python.core.PyObject
      extended by org.python.core.PySystemState
All Implemented Interfaces:
Serializable, ClassDictInit

public class PySystemState
extends PyObject
implements ClassDictInit

The "sys" module.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class org.python.core.PyObject
PyObject.ConversionException
 
Field Summary
 PyObject __dict__
           
 PyObject __displayhook__
           
 PyObject __excepthook__
           
 PyObject __name__
           
 PyObject __stderr__
           
 PyObject __stdin__
           
 PyObject __stdout__
           
static PyTuple _mercurial
           
 boolean _systemRestart
          true when a SystemRestart is triggered.
 PyList argv
          The arguments passed to this program on the command line.
static PyTuple builtin_module_names
           
static PyObject builtins
           
static PyString byteorder
           
static PyObject copyright
          The copyright notice for this release.
static PyObject exec_prefix
           
 PyObject executable
           
static int hexversion
           
static String JYTHON_DEV_JAR
           
static String JYTHON_JAR
           
 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 PyObject platform
           
static PyObject prefix
           
 PyObject ps1
           
 PyObject ps2
           
static String PYTHON_CACHEDIR
           
static String PYTHON_CACHEDIR_SKIP
           
static String PYTHON_CONSOLE_ENCODING
           
static Properties registry
           
 PyObject stderr
           
 PyObject stdin
           
 PyObject stdout
           
static PyTuple subversion
           
static PyString version
           
static PyTuple version_info
           
static PyList warnoptions
           
 
Fields inherited from class org.python.core.PyObject
TYPE
 
Constructor Summary
PySystemState()
           
 
Method Summary
 void __delattr__(String name)
          A variant of the __delattr__ method which accepts a String as the key.
 PyObject __findattr_ex__(String name)
          Attribute lookup hook.
 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 classDictInit(PyObject dict)
           
 void cleanup()
           
static void determinePlatform(Properties props)
           
static PySystemState doInitialize(Properties preProperties, Properties postProperties, String[] argv, ClassLoader classLoader, ExtensiblePyObjectAdapter adapter)
           
static void exc_clear()
           
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()
           
static String getBuiltin(String name)
           
 PyObject getBuiltins()
           
 ClassLoader getClassLoader()
           
 String getCurrentWorkingDir()
          Return a string representing the current working directory.
static PyObject getDefaultBuiltins()
           
 PyString getdefaultencoding()
           
 PyObject getfilesystemencoding()
           
 String getPath(String path)
          Resolve a path.
static String getPathLazy(String path)
          Resolve a path.
 PyObject getPlatform()
           
 int getrecursionlimit()
           
 PyObject getWarnoptions()
           
static void initialize()
           
static void initialize(Properties preProperties, Properties postProperties)
           
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, ExtensiblePyObjectAdapter adapter)
           
static boolean isPackageCacheEnabled()
           
 void registerCloser(Callable<Void> resourceCloser)
           
 void setBuiltins(PyObject value)
           
 void setClassLoader(ClassLoader classLoader)
           
 void setCurrentWorkingDir(String path)
          Change the current working directory to the specified path.
 void setdefaultencoding(String encoding)
           
 void setPlatform(PyObject value)
           
 void setprofile(PyObject profilefunc)
           
 void setrecursionlimit(int recursionlimit)
           
 void settrace(PyObject tracefunc)
           
 void setWarnoptions(PyObject value)
           
 void shadow()
           
 String toString()
           
 boolean unregisterCloser(Callable<Void> resourceCloser)
           
 
Methods inherited from class org.python.core.PyObject
__abs__, __add__, __and__, __call__, __call__, __call__, __call__, __call__, __call__, __call__, __call__, __call__, __call__, __call__, __call__, __call__, __call__, __call__, __call__, __cmp__, __coerce__, __coerce_ex__, __complex__, __contains__, __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__, __index__, __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__, __reduce_ex__, __reduce_ex__, __repr__, __rfloordiv__, __rlshift__, __rmod__, __rmul__, __ror__, __rpow__, __rrshift__, __rshift__, __rsub__, __rtruediv__, __rxor__, __set__, __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, _iadd, _iand, _idiv, _idivmod, _ifloordiv, _ilshift, _imod, _imul, _in, _ior, _ipow, _irshift, _is, _isnot, _isub, _itruediv, _ixor, _jcall, _jcallexc, _jthrow, _le, _lshift, _lt, _mod, _mul, _ne, _notin, _or, _pow, _rshift, _sub, _truediv, _xor, asDouble, asIndex, asIndex, asInt, asInt, asIterable, asLong, asLong, asName, asName, asString, asString, asStringOrNull, asStringOrNull, delDict, delType, dispatch__init__, equals, fastGetClass, fastGetDict, getDict, getType, hashCode, implementsDescrDelete, implementsDescrGet, implementsDescrSet, invoke, invoke, invoke, invoke, invoke, invoke, isCallable, isDataDescr, isIndex, isMappingType, isNumberType, isSequenceType, noAttributeError, readonlyAttributeError, setDict, setType
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

PYTHON_CACHEDIR

public static final String PYTHON_CACHEDIR
See Also:
Constant Field Values

PYTHON_CACHEDIR_SKIP

public static final String PYTHON_CACHEDIR_SKIP
See Also:
Constant Field Values

PYTHON_CONSOLE_ENCODING

public static final String PYTHON_CONSOLE_ENCODING
See Also:
Constant Field Values

JYTHON_JAR

public static final String JYTHON_JAR
See Also:
Constant Field Values

JYTHON_DEV_JAR

public static final String JYTHON_DEV_JAR
See Also:
Constant Field Values

version

public static final PyString version

hexversion

public static final int hexversion

version_info

public static PyTuple version_info

maxunicode

public static final int maxunicode
See Also:
Constant Field Values

subversion

public static PyTuple subversion

_mercurial

public static PyTuple _mercurial

copyright

public static final PyObject copyright
The copyright notice for this release.


builtin_module_names

public static PyTuple builtin_module_names

packageManager

public static PackageManager packageManager

registry

public static Properties registry

prefix

public static PyObject prefix

exec_prefix

public static PyObject exec_prefix

byteorder

public static final PyString byteorder

maxint

public static final int maxint
See Also:
Constant Field Values

minint

public static final int minint
See Also:
Constant Field Values

argv

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


modules

public PyObject modules

path

public PyList path

warnoptions

public static PyList warnoptions

builtins

public static PyObject builtins

platform

public static PyObject platform

meta_path

public PyList meta_path

path_hooks

public PyList path_hooks

path_importer_cache

public PyObject path_importer_cache

ps1

public PyObject ps1

ps2

public PyObject ps2

executable

public PyObject executable

stdout

public PyObject stdout

stderr

public PyObject stderr

stdin

public PyObject stdin

__stdout__

public PyObject __stdout__

__stderr__

public PyObject __stderr__

__stdin__

public PyObject __stdin__

__displayhook__

public PyObject __displayhook__

__excepthook__

public PyObject __excepthook__

last_value

public PyObject last_value

last_type

public PyObject last_type

last_traceback

public PyObject last_traceback

__name__

public PyObject __name__

__dict__

public PyObject __dict__

_systemRestart

public boolean _systemRestart
true when a SystemRestart is triggered.

Constructor Detail

PySystemState

public PySystemState()
Method Detail

classDictInit

public static void classDictInit(PyObject dict)

shadow

public void shadow()

getDefaultBuiltins

public static PyObject getDefaultBuiltins()

getBuiltins

public PyObject getBuiltins()

setBuiltins

public void setBuiltins(PyObject value)

getWarnoptions

public PyObject getWarnoptions()

setWarnoptions

public void setWarnoptions(PyObject value)

getPlatform

public PyObject getPlatform()

setPlatform

public void setPlatform(PyObject value)

__findattr_ex__

public PyObject __findattr_ex__(String name)
Description copied from class: PyObject
Attribute lookup hook. If the attribute is not found, null may be returned or a Py.AttributeError can be thrown, whatever is more correct, efficient and/or convenient for the implementing class. Client code should use PyObject.__getattr__(String) or PyObject.__findattr__(String). Both methods have a clear policy for failed lookups.

Overrides:
__findattr_ex__ in class PyObject
Returns:
The looked up value. May return null if the attribute is not found

__setattr__

public void __setattr__(String name,
                        PyObject value)
Description copied from class: PyObject
A variant of the __setattr__ method which accepts a String as the key. This String must be interned.

Overrides:
__setattr__ in class PyObject
Parameters:
name - the name whose value will be set - must be an interned string .
value - the value to set this name to
See Also:
PyObject.__setattr__(PyString, PyObject)

__delattr__

public void __delattr__(String name)
Description copied from class: PyObject
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 class PyObject
Parameters:
name - the name which will be removed - must be an interned string .
See Also:
PyObject.__delattr__(PyString)

__rawdir__

public void __rawdir__(PyDictionary accum)

toString

public String toString()
Overrides:
toString in class PyObject

getrecursionlimit

public int getrecursionlimit()

setrecursionlimit

public void setrecursionlimit(int recursionlimit)

settrace

public void settrace(PyObject tracefunc)

setprofile

public void setprofile(PyObject profilefunc)

getdefaultencoding

public PyString getdefaultencoding()

setdefaultencoding

public void setdefaultencoding(String encoding)

getfilesystemencoding

public PyObject getfilesystemencoding()

setCurrentWorkingDir

public void setCurrentWorkingDir(String path)
Change the current working directory to the specified path. path is assumed to be absolute and canonical (via os.path.realpath).

Parameters:
path - a path String

getCurrentWorkingDir

public String getCurrentWorkingDir()
Return a string representing the current working directory.

Returns:
a path String

getPath

public String getPath(String path)
Resolve a path. Returns the full path taking the current working directory into account.

Parameters:
path - a path String
Returns:
a resolved path String

getPathLazy

public static String getPathLazy(String path)
Resolve a path. Returns the full path taking the current working directory into account. Like getPath but called statically. The current PySystemState is only consulted for the current working directory when it's necessary (when the path is relative).

Parameters:
path - a path String
Returns:
a resolved path String

callExitFunc

public void callExitFunc()
                  throws PyIgnoreMethodTag
Throws:
PyIgnoreMethodTag

getClassLoader

public ClassLoader getClassLoader()

setClassLoader

public void setClassLoader(ClassLoader classLoader)

determinePlatform

public static void determinePlatform(Properties props)

getBaseProperties

public static Properties getBaseProperties()

initialize

public static void initialize()

initialize

public static void initialize(Properties preProperties,
                              Properties postProperties)

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,
                              ExtensiblePyObjectAdapter adapter)

doInitialize

public static PySystemState doInitialize(Properties preProperties,
                                         Properties postProperties,
                                         String[] argv,
                                         ClassLoader classLoader,
                                         ExtensiblePyObjectAdapter adapter)

isPackageCacheEnabled

public static boolean isPackageCacheEnabled()

getBuiltin

public static String getBuiltin(String name)

add_package

public static PyJavaPackage add_package(String n)

add_package

public static PyJavaPackage add_package(String n,
                                        String contents)

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.
See Also:
add_classdir(java.lang.String)

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.
See Also:
add_classdir(java.lang.String)

exit

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

Parameters:
status - the value to exit with
Throws:
Py.SystemExit - always throws this exception. When caught at top level the program will exit.

exit

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


exc_info

public static PyTuple exc_info()

exc_clear

public static void exc_clear()

_getframe

public static PyFrame _getframe()

_getframe

public static PyFrame _getframe(int depth)

registerCloser

public void registerCloser(Callable<Void> resourceCloser)

unregisterCloser

public boolean unregisterCloser(Callable<Void> resourceCloser)

cleanup

public void cleanup()


Jython homepage