Top Description Inners Fields Constructors Methods
org.python.core

public Class PySystemState

Additional top-level classes in compilation unit: PySystemStateFunctions, PyAttributeDeleted, FloatInfo, LongInfo, WinVersion.

extends PyObject
implements AutoCloseable, ClassDictInit, Closeable, Traverseproc
Class Inheritance
All Implemented Interfaces
org.python.core.Traverseproc, java.io.Closeable, java.lang.AutoCloseable, org.python.core.ClassDictInit
Static Imports
org.python.core.RegistryKey.PYTHON_CACHEDIR, .RegistryKey.PYTHON_CACHEDIR_SKIP, .RegistryKey.PYTHON_CONSOLE, .RegistryKey.PYTHON_CONSOLE_ENCODING, .RegistryKey.PYTHON_IO_ENCODING, .RegistryKey.PYTHON_IO_ERRORS, .RegistryKey.PYTHON_MODULES_BUILTIN, .RegistryKey.PYTHON_PATH, .RegistryKey.USER_HOME

The "sys" module.

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class
public static class

Field Summary

Modifier and TypeField and Description
public PyObject
public PyObject
public PyObject
public PyObject
public PyObject
public PyObject
public PyObject
public static final PyTuple
public PyList
argv

The arguments passed to this program on the command line.

public static PyTuple
private static Map<String, String>
public PyObject
public static final PyString
private static File
private static final String
private int
private ClassLoader
private final PySystemState.PySystemStateCloser
private volatile codecs.CodecState
public static final PyObject
copyright

The copyright notice for this release.

private String
private static PyList
private static PyObject
private static PyList
private static PyObject
public boolean
dont_write_bytecode

Whether bytecode should be written to disk on import.

public static PyObject
exec_prefix

A string giving the site-specific directory prefix where the platform-dependent Python files are installed; by default, this is the same as exec_prefix.

public PyObject
pack-priv static final PyString
FILE_SYSTEM_ENCODING

Nominal Jython file system encoding (as sys.getfilesystemencoding())

public static final Class<T>
public static final PyObject
public static final PyString
public static final int
private ReentrantLock
private static boolean
private static final String
public static final String
public static final String
public PyObject
public PyObject
public PyObject
private static final Logger
public static final PyObject
public static final int
public static final int
public static final int
public PyList
public static final int
public PyObject
public Map<String, PyModule>
public static PackageManager
public PyList
public PyList
public PyObject
public PyObject
public static PyObject
prefix

A string giving the site-specific directory prefix where the platform independent Python files are installed; by default, this is based on the property python.home or the location of the Jython JAR.

public PyObject
public PyObject
public static boolean
private int
public static Properties
public PyObject
public PyObject
public PyObject
public static final PyTuple
private static final ConcurrentMap<WeakReference<PySystemState>, PySystemState.PySystemStateCloser>
private ClassLoader
private static final ReferenceQueue<PySystemState>
public static final PyString
public static final PyVersionInfo
public PyList
Inherited from org.python.core.PyObject:
attributesgcMonitorGlobalobjtypeTYPE

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
__delattr__(String
the name which will be removed - must be an interned string .
name
)

Overrides org.python.core.PyObject.__delattr__.

A variant of the __delattr__ method which accepts a String as the key.

public PyObject
__findattr_ex__(String name)

Overrides org.python.core.PyObject.__findattr_ex__.

Attribute lookup hook.

public void
public void
__setattr__(String
the name whose value will be set - must be an interned string .
name
,
PyObject
the value to set this name to
value
)

Overrides org.python.core.PyObject.__setattr__.

A variant of the __setattr__ method which accepts a String as the key.

public static PyDictionary
public static PyFrame
public static PyFrame
_getframe(int depth)

public static void
add_classdir(String directoryPath)

Add a classpath directory to the list of places that are searched for java packages.

public static void
add_extdir(String
The name of a directory.
directoryPath
)

Add a .jar and .zip directory to the list of places that are searched for java .jar and .zip files.

public static void
add_extdir(String
The name of a directory.
directoryPath
,
boolean
Controls if the packages in the zip and jar file should be cached.
cache
)

Add a .jar and .zip directory to the list of places that are searched for java .jar and .zip files.

public static PyJavaPackage
public static PyJavaPackage
add_package(String n, String contents)

private static void
private static void
addPaths(PyList path, String pypath)

private static void
addRegistryFile(File file)

Merge the contents of a property file into the registry, but existing entries with the same key take precedence.

public void
private static void
private static void
public static void
public void
public void
close()

Implements java.lang.AutoCloseable.close, java.io.Closeable.close.

Closes this resource, relinquishing any underlying resources.

private static void
determinePlatform(Properties props)

Set defaultPlatform by examination of the java.version JVM property.

pack-priv static void
public static synchronized PySystemState
doInitialize(Properties preProperties, Properties postProperties, String[] argv, ClassLoader classLoader, ExtensiblePyObjectAdapter adapter)

private static char

Returns:

drive letter or char 0 if no drive letter
driveLetter
(String
to examine
path
)

Return the Windows drive letter from the start of the path, upper case, or 0 if the path does not start X: where X is a letter.

public static void
public static PyTuple
pack-priv static void
public static void
exit(PyObject
the value to exit with
status
)

Exit a Python program with the given status.

public static void
exit()

Exit a Python program with the status 0.

private static String
findRoot(Properties preProperties, Properties postProperties, String jarFileName)

Work out the root directory of the installation of Jython.

public static Properties
public static String
public PyObject
public PyInteger
public ClassLoader
public codecs.CodecState
private static String

Returns:

the console encoding (and never null)
getConsoleEncoding
(Properties
in which to look for clues (normally the Jython registry)
props
)

Try to determine the console encoding from the platform, if necessary using a sub-process to enquire.

public String

Returns:

a path String
getCurrentWorkingDir
()

Return a string representing the current working directory.

public static PyObject
public PyString
public File

Returns:

a resolved File
getFile
(String
a path String
path
)

Resolve a path, returning a File, taking the current working directory into account.

private static File

Returns:

a resolved File
getFile
(PySystemState
a PySystemState or null meaning the current one
sys
,
String
a path String
path
)

Resolve a path, returning a File, taking the current working directory of the specified PySystemState into account.

public PyObject
public ReentrantLock
public static String
getNativePlatform()

Emulates CPython's way to name sys.platform.

public String

Returns:

a resolved path String
getPath
(String
a path String
path
)

Resolve a path.

private static String
public static String

Returns:

a resolved path String
getPathLazy
(String
a path String
path
)

Resolve a path.

public PyObject
public PyObject
public int
public long
getsizeof(Object obj, long defaultVal)

public long
public ClassLoader
public static String
getSystemVersionString()

Attempt to find the OS version.

public PyObject
private static PyVersionInfo
public PyObject
private static File

Returns:

specifier of the intended file
getWindowsFile
(String
current working directory (of some PySystemState)
cwd
,
String
to resolve
path
)

Resolve a relative path against the supplied current working directory or Windows environment working directory for any drive specified in the path.

public WinVersion
private static PyList
initArgv(String[] args)

private static void
private static void
private static void
initConsole(Properties
containing (or not) python.console
props
)

Wrap standard input with a customised console handler specified in the property python.console in the supplied property set, which in practice is the fully-initialised Jython registry.

private void
initEncoding()

Initialise the encoding of sys.stdin, sys.stdout, and sys.stderr, and their error handling policy, from registry variables.

private static PyObject

Returns:

a PyObject path string or Py.None
initExecutable
(Properties
a Properties registry
props
)

Determine the default sys.executable value from the registry.

public static synchronized void
public static synchronized void
initialize(Properties preProperties, Properties postProperties)

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

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

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

private static boolean

Returns:

true if a service is found and successfully initializes.
initialize
(Properties pre, Properties post, String[] argv, ClassLoader sysClassLoader, ExtensiblePyObjectAdapter adapter, ClassLoader initializerClassLoader)

Attempts to read a SystemStateInitializer service from the given class loader, instantiate it, and initialize with it.

private static void
private static PyList
initPath(Properties props, boolean standalone, String jarFileName)

private static void
initRegistry(Properties
initial registry
preProperties
,
Properties
overriding values
postProperties
,
boolean
default python.cachedir.skip to true (if not otherwise defined)
standalone
,
String
as a clue to the location of the installation
jarFileName
)

Install the first argument as the application-wide registry (a java.util.Properties object), merge values from system and local (or user) properties files, and finally allow values from postProperties to override.

public static boolean
private static boolean

Returns:

true if we have a standalone .jar file, false otherwise.
isStandalone
(String
The name of the jar file
jarFileName
)

Check if we are in standalone mode.

public boolean
public void
registerCloser(Callable<Void> resourceCloser)

pack-priv void
public void
public void
setcheckinterval(int interval)

public void
public void
setCurrentWorkingDir(String
a path String
path
)

Change the current working directory to the specified path.

public void
public void
public void
setprofile(PyObject profilefunc)

public void
setrecursionlimit(int recursionlimit)

public void
settrace(PyObject tracefunc)

public void
public void
shadow()
Deprecated

public String
toString()

Overrides org.python.core.PyObject.toString.

Returns a string representation of the object.

public int
traverse(Visitproc visit, Object arg)

Implements org.python.core.Traverseproc.traverse.

Traverses all directly contained PyObjects.

private static String

Returns:

share name or null
uncShare
(String
to examine
path
)

Return the Windows UNC share name from the start of the path, or null if the path is not of Windows UNC type.

public boolean
unregisterCloser(Callable<Void> resourceCloser)

private static void
writeConsoleWarning(String
console class name we're trying to initialise
consoleName
,
String
specific cause of the failure
msg
)

Convenience method wrapping Py#writeWarning(String, String) to issue a warning message something like: "console: Failed to load 'org.python.util.ReadlineConsole': msg.".

Inherited from 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_basic_add_basic_and_basic_div_basic_divmod_basic_floordiv_basic_iadd_basic_iand_basic_idiv_basic_idivmod_basic_ifloordiv_basic_ilshift_basic_imod_basic_imul_basic_ior_basic_ipow_basic_irshift_basic_isub_basic_itruediv_basic_ixor_basic_lshift_basic_mod_basic_mul_basic_or_basic_pow_basic_rshift_basic_sub_basic_truediv_basic_xor_callextra_cmp_coerce_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_unsupportedop_xoradaptToCoerceTupleasDoubleasIndexasIndexasIntasIntasIterableasLongasLongasNameasNameasStringasStringasStringOrNullasStringOrNullbit_lengthconjugatedelDictdelTypedispatch__init__equalsfastGetClassfastGetDictfinalizegetDictgetJavaProxygetTypehashCodeimpAttrimplementsDescrDeleteimplementsDescrGetimplementsDescrSetinvokeinvokeinvokeinvokeinvokeinvokeisCallableisDataDescrisIndexisIntegerisMappingTypeisNumberTypeisSequenceTypejdontdelmergeClassDictmergeDictAttrmergeListAttrnoAttributeErrorobject___contains__object___delattr__object___delattr__object___findattr__object___format__object___getattribute__object___hash__object___init__object___new__object___reduce__object___reduce_ex__object___setattr__object___setattr__object___subclasshook__object_toStringproxyInitreadonlyAttributeErrorrunsupportedopMessagesetDictsetTypeunsupportedopMessage