Class Options

java.lang.Object
org.python.core.Options

public class Options extends Object
A class with static fields for each of the settable options. The options from registry and command line is copied into the fields here and the rest of Jython checks these fields.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static int
     
    static boolean
    If true, Jython will use the first module found on sys.path where java File.isFile() returns true.
    static int
    Enable division warning.
    static boolean
    Whether -B (don't write bytecode on import) was enabled via the command line.
    static boolean
    Whether -E (ignore environment) was enabled via the command line.
    static boolean
    When false the site.py will not be imported.
    static boolean
    If true, exceptions raised from Python code will include a Java stack trace in addition to the Python traceback.
    static boolean
    When a script given on the command line finishes, start an interactive interpreter.
    static boolean
    Set by the -i option to the interpreter command, to ask for an interactive session to start after the script ends.
    static boolean
    When true the site.py was not imported.
    static boolean
    Whether -s (don't add user site directory to sys.path) was on the command line.
    static int
    Corresponds to -O (Python bytecode optimization), -OO (remove docstrings) flags in CPython.
    static String
    A directory where the dynamically generated classes are written.
    static boolean
    Whether -3 (py3k warnings) was enabled via the command line.
    static boolean
    If true, enable true division for the '/' operator.
    static boolean
    If true, Jython respects Java the accessibility flag for fields, methods, and constructors.
    static boolean
    when an exception occurs in Java code, and it is not caught, should the interpreter print out the Java exception in the traceback?
    static boolean
    When true, python exception raised in overridden methods will be shown on stderr.
    static String
     
    static final String
    Cache spec for the SRE_STATE code point cache.
    static boolean
    Force stdin, stdout and stderr to be unbuffered, and opened in binary mode.
    static int
    Deprecated.
    Use PrePy.getLoggingLevel(), PrePy.setLoggingLevel(java.util.logging.Level), or java.util.logging preferences to configure logging levels.
  • Method Summary

    Modifier and Type
    Method
    Description
    static void
    Initialize the static fields from the registry options.

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • showJavaExceptions

      public static boolean showJavaExceptions
      when an exception occurs in Java code, and it is not caught, should the interpreter print out the Java exception in the traceback?
    • includeJavaStackInExceptions

      public static boolean includeJavaStackInExceptions
      If true, exceptions raised from Python code will include a Java stack trace in addition to the Python traceback. This can slow raising considerably.
      See Also:
    • showPythonProxyExceptions

      public static boolean showPythonProxyExceptions
      When true, python exception raised in overridden methods will be shown on stderr. This option is remarkably useful when python is used for implementing CORBA server. Some CORBA servers will turn python exception (say a NameError) into an anonymous user exception without any stacktrace. Setting this option will show the stacktrace.
      See Also:
    • respectJavaAccessibility

      public static boolean respectJavaAccessibility
      If true, Jython respects Java the accessibility flag for fields, methods, and constructors. This means you can only access public members. Set this to false to access all members by toggling the accessible flag on the member.
      See Also:
    • importSite

      public static boolean importSite
      When false the site.py will not be imported. This may be set by the command line main class (-S option) or from the registry and is checked in PythonInterpreter.
      See Also:
    • no_site

      public static boolean no_site
      When true the site.py was not imported. This is may be set by the command line main class (-S option) or from the registry. However, in Jython 2, no_site is simply the opposite of importSite, as the interpreter starts up, provided for compatibility with the standard Python sys.flags. Actual control over the import of the site module in Jython 2, when necessary from Java, is accomplished through importSite.
    • verbose

      @Deprecated public static int verbose
      Deprecated.
      Use PrePy.getLoggingLevel(), PrePy.setLoggingLevel(java.util.logging.Level), or java.util.logging preferences to configure logging levels.
      Verbosity of informative messages from Jython, retained as a field for reasons of backward-compatibility. Normally this option should be allowed to find its value indirectly through java.util.logging, as adjusted by the command line -v option.
    • interactive

      public static boolean interactive
      Set by the -i option to the interpreter command, to ask for an interactive session to start after the script ends. It also allows certain streams to be considered interactive when isatty is not available.
    • inspect

      public static boolean inspect
      When a script given on the command line finishes, start an interactive interpreter. It is set true by the -i option on the command-line, or programmatically from the script, and reset to false just before the interactive session starts. (This session only actually starts if the console is interactive.)
    • proxyDebugDirectory

      public static String proxyDebugDirectory
      A directory where the dynamically generated classes are written. Nothing is ever read from here, it is only for debugging purposes.
    • caseok

      public static boolean caseok
      If true, Jython will use the first module found on sys.path where java File.isFile() returns true. Setting this to true have no effect on unix-type filesystems. On Windows/HFS+ systems setting it to true will enable Jython-2.0 behaviour.
      See Also:
    • Qnew

      public static boolean Qnew
      If true, enable true division for the '/' operator.
      See Also:
    • unbuffered

      public static boolean unbuffered
      Force stdin, stdout and stderr to be unbuffered, and opened in binary mode.
    • py3k_warning

      public static boolean py3k_warning
      Whether -3 (py3k warnings) was enabled via the command line.
    • dont_write_bytecode

      public static boolean dont_write_bytecode
      Whether -B (don't write bytecode on import) was enabled via the command line.
    • ignore_environment

      public static boolean ignore_environment
      Whether -E (ignore environment) was enabled via the command line.
    • no_user_site

      public static boolean no_user_site
      Whether -s (don't add user site directory to sys.path) was on the command line. The implementation is mostly in the site module.
    • bytes_warning

      public static int bytes_warning
    • optimize

      public static int optimize
      Corresponds to -O (Python bytecode optimization), -OO (remove docstrings) flags in CPython. Jython processes the option and makes it visible as of 2.7, but there is no change of behaviour in the current version.
    • division_warning

      public static int division_warning
      Enable division warning. The value maps to the registry values of
      • old: 0
      • warn: 1
      • warnall: 2
    • sreCacheSpecDefault

      public static final String sreCacheSpecDefault
      Cache spec for the SRE_STATE code point cache. The value maps to the CacheBuilderSpec string and affects how the SRE_STATE cache will behave/evict cached PyString -> int[] code points.
      See Also:
    • sreCacheSpec

      public static String sreCacheSpec
  • Method Details

    • setFromRegistry

      public static void setFromRegistry()
      Initialize the static fields from the registry options.