Class PySystemState
- All Implemented Interfaces:
Closeable
,Serializable
,AutoCloseable
,ClassDictInit
,Traverseproc
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class org.python.core.PyObject
PyObject.ConversionException
-
Field Summary
Modifier and TypeFieldDescriptionstatic final PyTuple
The arguments passed to this program on the command line.static PyTuple
static final PyString
static final PyObject
The copyright notice for this release.boolean
Whether bytecode should be written to disk on import.static PyObject
A string giving the site-specific directory prefix where the platform-dependent Python files are installed; by default, this is the same asexec_prefix
.static final Class
static final PyObject
static final PyString
static final int
static final String
static final String
static final PyObject
static final int
static final int
static final int
static final int
static PackageManager
static PyObject
A string giving the site-specific directory prefix where the platform independent Python files are installed; by default, this is based on the propertypython.home
or the location of the Jython JAR.static boolean
static Properties
static final PyTuple
static final PyString
static final PyVersionInfo
Fields inherited from class org.python.core.PyObject
gcMonitorGlobal, TYPE
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
__delattr__
(String name) A variant of the __delattr__ method which accepts a String as the key.__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 PyDictionary
static PyFrame
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 and .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 and .zip directory to the list of places that are searched for java .jar and .zip files.static PyJavaPackage
static PyJavaPackage
add_package
(String n, String contents) void
static void
classDictInit
(PyObject dict) void
cleanup()
void
close()
static PySystemState
doInitialize
(Properties preProperties, Properties postProperties, String[] argv, ClassLoader classLoader, ExtensiblePyObjectAdapter adapter) static void
static PyTuple
exc_info()
static void
exit()
Exit a Python program with the status 0.static void
Exit a Python program with the given status.static Properties
static String
getBuiltin
(String name) Return a string representing the current working directory.static PyObject
Resolve a path, returning aFile
, taking the current working directory into account.static String
Emulates CPython's way to name sys.platform.Resolve a path.static String
getPathLazy
(String path) Resolve a path.int
static String
Attempt to find the OS version.gettrace()
org.python.core.WinVersion
static void
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
boolean
Optional operation.void
registerCloser
(Callable<Void> resourceCloser) void
setBuiltins
(PyObject value) void
setcheckinterval
(int interval) 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
void
setWarnoptions
(PyObject value) void
shadow()
Deprecated.toString()
int
Traverses all directly containedPyObject
s.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__, __ensure_finalizer__, __eq__, __findattr__, __findattr__, __finditem__, __finditem__, __finditem__, __float__, __floordiv__, __format__, __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__, __trunc__, __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, bit_length, conjugate, delDict, delType, dispatch__init__, equals, fastGetClass, fastGetDict, getDict, getType, hashCode, implementsDescrDelete, implementsDescrGet, implementsDescrSet, invoke, invoke, invoke, invoke, invoke, invoke, isCallable, isDataDescr, isIndex, isInteger, isMappingType, isNumberType, isSequenceType, noAttributeError, object___subclasshook__, readonlyAttributeError, setDict, setType
-
Field Details
-
JYTHON_JAR
- See Also:
-
JYTHON_DEV_JAR
- See Also:
-
version
-
subversion
-
hexversion
public static final int hexversion -
version_info
-
maxunicode
public static final int maxunicode- See Also:
-
maxsize
public static final int maxsize- See Also:
-
float_repr_style
-
py3kwarning
public static boolean py3kwarning -
flags
-
_git
-
copyright
The copyright notice for this release. -
builtin_module_names
-
packageManager
-
registry
-
prefix
A string giving the site-specific directory prefix where the platform independent Python files are installed; by default, this is based on the propertypython.home
or the location of the Jython JAR. The main collection of Python library modules is installed in the directoryprefix/Lib
. This object should contain bytes in the file system encoding for consistency with use in the standard library (seesysconfig.py
). -
exec_prefix
A string giving the site-specific directory prefix where the platform-dependent Python files are installed; by default, this is the same asexec_prefix
. This object should contain bytes in the file system encoding for consistency with use in the standard library (seesysconfig.py
). -
byteorder
-
maxint
public static final int maxint- See Also:
-
minint
public static final int minint- See Also:
-
argv
The arguments passed to this program on the command line. -
modules
-
modules_reloading
-
path
-
warnoptions
-
builtins
-
platform
-
meta_path
-
path_hooks
-
path_importer_cache
-
ps1
-
ps2
-
executable
-
stdout
-
stderr
-
stdin
-
__stdout__
-
__stderr__
-
__stdin__
-
__displayhook__
-
__excepthook__
-
last_value
-
last_type
-
last_traceback
-
__name__
-
__dict__
-
dont_write_bytecode
public boolean dont_write_bytecodeWhether bytecode should be written to disk on import. -
float_info
-
long_info
-
-
Constructor Details
-
PySystemState
public PySystemState()
-
-
Method Details
-
classDictInit
-
shadow
Deprecated. -
getDefaultBuiltins
-
getBuiltins
-
setBuiltins
-
getWarnoptions
-
setWarnoptions
-
getPlatform
-
setPlatform
-
getwindowsversion
public org.python.core.WinVersion getwindowsversion() -
getCodecState
-
getImportLock
-
getSyspathJavaLoader
-
__findattr_ex__
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 usePyObject.__getattr__(String)
orPyObject.__findattr__(String)
. Both methods have a clear policy for failed lookups.- Overrides:
__findattr_ex__
in classPyObject
- Returns:
- The looked up value. May return null if the attribute is not found
-
__setattr__
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 classPyObject
- Parameters:
name
- the name whose value will be set - must be an interned string .value
- the value to set this name to- See Also:
-
__delattr__
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 classPyObject
- Parameters:
name
- the name which will be removed - must be an interned string .- See Also:
-
__rawdir__
-
toString
-
getrecursionlimit
public int getrecursionlimit() -
setrecursionlimit
public void setrecursionlimit(int recursionlimit) -
gettrace
-
settrace
-
getprofile
-
setprofile
-
getdefaultencoding
-
setdefaultencoding
-
getfilesystemencoding
-
getcheckinterval
-
setcheckinterval
public void setcheckinterval(int interval) -
setCurrentWorkingDir
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
Return a string representing the current working directory.- Returns:
- a path String
-
getPath
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
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
-
getFile
Resolve a path, returning aFile
, taking the current working directory into account.- Parameters:
path
- a pathString
- Returns:
- a resolved
File
-
callExitFunc
- Throws:
PyIgnoreMethodTag
-
getClassLoader
-
setClassLoader
-
getNativePlatform
Emulates CPython's way to name sys.platform. Works according to this table:Platform names System Value Linux (2.x and 3.x) linux2 Windows win32 Windows/Cygwin cygwin Mac OS X darwin OS/2 os2 OS/2 EMX os2emx RiscOS riscos AtheOS atheos -
getBaseProperties
-
initialize
public static void initialize() -
initialize
-
initialize
-
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
-
add_package
-
add_package
-
add_classdir
Add a classpath directory to the list of places that are searched for java packages.Note. Classes found in directory and sub-directory are not made available to jython by this call. It only makes the java package found in the directory available. This call is mostly useful if jython is embedded in an application that deals with its own class loaders. A servlet container is a very good example. Calling
add_classdir("<context>/WEB-INF/classes")
makes the java packages in WEB-INF classes available to jython import. However the actual class loading is completely handled by the servlet container's context classloader. -
add_extdir
Add a .jar and .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_extdir
Add a .jar and .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:
-
exit
Exit a Python program with the given status.- Parameters:
status
- the value to exit with- Throws:
PyException
-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
-
exc_clear
public static void exc_clear() -
_getframe
-
_getframe
-
_current_frames
-
registerCloser
-
unregisterCloser
-
cleanup
public void cleanup() -
close
public void close()- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
-
getSystemVersionString
Attempt to find the OS version. The mechanism on Windows is to extract it from the result ofcmd.exe /C ver
, and otherwise (assumed Unix-like OS) to useuname -v</code>
. -
traverse
Description copied from interface:Traverseproc
Traverses all directly containedPyObject
s. Like in CPython,arg
must be passed unmodified tovisit
as its second parameter. IfVisitproc.visit(PyObject, Object)
returns nonzero, this return value must be returned immediately by traverse.Visitproc.visit(PyObject, Object)
must not be called with anull
PyObject-argument.- Specified by:
traverse
in interfaceTraverseproc
-
refersDirectlyTo
Description copied from interface:Traverseproc
Optional operation. Should only be implemented if it is more efficient than callingTraverseproc.traverse(Visitproc, Object)
with a visitproc that just watches out forob
. Must returnfalse
ifob
isnull
.- Specified by:
refersDirectlyTo
in interfaceTraverseproc
-