Class PySystemState

java.lang.Object
org.python.core.PyObject
org.python.core.PySystemState
All Implemented Interfaces:
Serializable

public class PySystemState extends PyObject
The "sys" module.
See Also:
  • Field Details

    • JYTHON_JAR

      public static final String JYTHON_JAR
      See Also:
    • 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

    • hexversion

      public static int hexversion
    • version_info

      public static PyTuple version_info
    • maxunicode

      public static int maxunicode
    • argv

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

      public PyObject modules
    • path

      public PyList path
    • builtins

      public static PyObject builtins
    • meta_path

      public PyList meta_path
    • path_hooks

      public PyList path_hooks
    • path_importer_cache

      public PyObject path_importer_cache
    • platform

      public static String platform
    • byteorder

      public static String byteorder
    • ps1

      public PyObject ps1
    • ps2

      public PyObject ps2
    • maxint

      public static int maxint
    • minint

      public static int minint
    • executable

      public PyObject executable
    • warnoptions

      public static PyList warnoptions
    • 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
    • __dict__

      public PyObject __dict__
    • registry

      public static Properties registry
    • prefix

      public static String prefix
    • exec_prefix

      public static String exec_prefix
    • packageManager

      public static PackageManager packageManager
    • cachedir

      public static File cachedir
    • builtin_module_names

      public static String[] builtin_module_names
    • tracefunc

      public TraceFunction tracefunc
    • profilefunc

      public TraceFunction profilefunc
  • Constructor Details

    • PySystemState

      public PySystemState()
  • Method Details

    • 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.
    • getClassLoader

      public ClassLoader getClassLoader()
    • setClassLoader

      public void setClassLoader(ClassLoader classLoader)
    • exc_info

      public static PyTuple exc_info()
    • _getframe

      public static PyFrame _getframe()
    • _getframe

      public static PyFrame _getframe(int depth)
    • __findattr__

      public PyObject __findattr__(String name)
      Description copied from class: PyObject
      A variant of the __findattr__ method which accepts a Java String as the name. Warning: name must be an interned string!
      Overrides:
      __findattr__ in class 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
      See Also:
    • __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:
    • __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:
    • __rawdir__

      public void __rawdir__(PyDictionary accum)
    • safeRepr

      public String safeRepr() throws PyIgnoreMethodTag
      Overrides:
      safeRepr in class PyObject
      Throws:
      PyIgnoreMethodTag
    • toString

      public String toString()
      Overrides:
      toString in class PyObject
    • getrecursionlimit

      public int getrecursionlimit()
    • setrecursionlimit

      public void setrecursionlimit(int recursionlimit)
    • 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, 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)
    • classCache

      public static File classCache()
    • isPackageCacheEnabled

      public static boolean isPackageCacheEnabled()
    • 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_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:
    • settrace

      public void settrace(PyObject tracefunc)
    • setprofile

      public void setprofile(PyObject profilefunc)
    • getdefaultencoding

      public String getdefaultencoding()
    • setdefaultencoding

      public void setdefaultencoding(String encoding)
    • callExitFunc

      public void callExitFunc() throws PyIgnoreMethodTag
      Throws:
      PyIgnoreMethodTag