| Modifier and Type | Class and Description |
|---|---|
| pack-priv static class | jython.
Class providing a parser for Jython command line options. |
| private static enum | jython.
Exit status: must have |
| Modifier and Type | Field and Description |
|---|---|
| public static final String | CONSOLE_LOG_FORMAT
The default format for console log messages in the command-line Jython. |
| private static ConsoleHandler | consoleHandler
The console handler we normally attach to "org.python". |
| private static final String | |
| private static final Logger | logger
The root of the Jython Logger hierarchy, named "org.python". |
| private static final String | |
| pack-priv static final String | usageBody
The message additional to |
| pack-priv static final String | usageHeader
The message output when reporting command-line errors and when asked for help. |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| private static boolean | Returns: true iff a value was setto be (possibly) updated registry, String at which to set value key, String to set (or value)null for no setting)If the key is not currently present and the passed value is not |
| private static void | addDefaultsFromEnvironment(Properties
to be (possibly) updated registry)Provides default registry entries from particular supported environment variables, obtained
by calls to |
| private static void | addFSEncoded(Iterable<String>
of source, PyList Stringslist destination)Append strings to a PyList as |
| private static void | addWarnOptionsFromEnv(PyList
the list to which the options are appended. opts)Append options from the environment variable |
| private static void | configureSimpleFormatter(String
to set for format)java.util.logging.SimpleFormatterTry to set the format for |
| private static void | |
| private static synchronized ConsoleHandler | Returns: ConfiguredconsoleHandlerGet or lazily create the console handler we normally attach to "org.python", which uses
|
| private static String | Returns: the corresponding value ordefaultValue.to access in the environment (if allowed by
name)Options#ignore_environment==false).The same as |
| private static String | Returns: the corresponding value ordefaultValue.to access in the environment (if allowed by
name, String Options#ignore_environment==false).to return if defaultValue)name is not defined, is "" or access is forbidden.Get the value of an environment variable, respecting |
| public static void | loggingToConsole()
Events from within the Jython implementation are surfaced through the
|
| public static void | loggingToDefault()
Mostly reverse the effects of |
| public static void | |
| private static void | optionNotSupported(char option)
Non-fatal error message when ignoring unsupported option (usually one valid for CPython). |
| private static void | printError(String
suitable to use in format, Object... String.format(format, args)zero or more args args)Print |
| public static void | |
| private static jython. | Returns: Status.OK on normal termination, Status.NO_FILE if the file cannot be
read, or Status.ERROR on other IOExceptions.the name of the file or filename, InteractiveConsole null meaning "???"to do the work interp)Attempt to open the named file and execute it in the interpreter as |
| public static int | |
| private static jython. | Returns: Status.OK or Status.NOT_RUN (if the file was not an archive).to run (FS encoded name) archive)Attempt to treat a file as a source of imports, import a module |
| private static jython. | |
| private static jython. | Returns: Status.OK on normal termination.Python source code fp, String appears FS-encoded in variable filename, PythonInterpreter __file__ and in error messagesto do the work interp)Execute the stream |
| private static void | runStartupFile(InteractiveConsole
to do the work interp)Attempt to execute the file named in the registry entry |
| private static jython. | Returns: Status.OK on normal termination.Python source code fp, String the name of the file or filename, InteractiveConsole null meaning "???"to do the work interp)Execute the stream |
| pack-priv static jython. |
| CONSOLE_LOG_FORMAT | back to summary |
|---|---|
| public static final String CONSOLE_LOG_FORMAT The default format for console log messages in the command-line Jython. See
This format is used in the absence of other logging preferences, and only if property
You can choose something else, for example to log with millisecond time stamps, launch Jython as: jython -vv -J-Djava.util.logging.SimpleFormatter.format="[%1$tT.%1$tL] %3$s: (%4$s) %5$s%n"Depending on your shell, the argument may need quoting or escaping. | |
| consoleHandler | back to summary |
|---|---|
| private static ConsoleHandler consoleHandler The console handler we normally attach to "org.python". See | |
| COPYRIGHT | back to summary |
|---|---|
| private static final String COPYRIGHT | |
| logger | back to summary |
|---|---|
| private static final Logger logger The root of the Jython Logger hierarchy, named "org.python". | |
| PYTHON_CONSOLE_CLASS | back to summary |
|---|---|
| private static final String PYTHON_CONSOLE_CLASS | |
| usageBody | back to summary |
|---|---|
| pack-priv static final String usageBody The message additional to | |
| usageHeader | back to summary |
|---|---|
| pack-priv static final String usageHeader The message output when reporting command-line errors and when asked for help. | |
| jython | back to summary |
|---|---|
| public jython() | |
| addDefault | back to summary |
|---|---|
| private static boolean addDefault(Properties registry, String key, String value) If the key is not currently present and the passed value is not
true iff a value was set | |
| addDefaultsFromEnvironment | back to summary |
|---|---|
| private static void addDefaultsFromEnvironment(Properties registry) Provides default registry entries from particular supported environment variables, obtained
by calls to
| |
| addFSEncoded | back to summary |
|---|---|
| private static void addFSEncoded(Iterable<String> source, PyList destination) Append strings to a PyList as | |
| addWarnOptionsFromEnv | back to summary |
|---|---|
| private static void addWarnOptionsFromEnv(PyList opts) Append options from the environment variable
| |
| configureSimpleFormatter | back to summary |
|---|---|
| private static void configureSimpleFormatter(String format) throws SecurityException Try to set the format for
| |
| exit | back to summary |
|---|---|
| private static void exit(jython. Exit Jython with status (converted to an integer). | |
| getConsoleHandler | back to summary |
|---|---|
| private static synchronized ConsoleHandler getConsoleHandler() throws SecurityException Get or lazily create the console handler we normally attach to "org.python", which uses
| |
| getenv | back to summary |
|---|---|
| private static String getenv(String name) The same as
| |
| getenv | back to summary |
|---|---|
| private static String getenv(String name, String defaultValue) Get the value of an environment variable, respecting
This accesses the read-only Java copy of the system environment directly, not
the corresponding value or | |
| loggingToConsole | back to summary |
|---|---|
| public static void loggingToConsole() Events from within the Jython implementation are surfaced through the
The root logger format is hard to read for humans. The logging level of the handler defaults
to
org.python and its child loggers by default, which determines
admission of logging, reflects the "verbosity" set by the `-v` option.
| |
| loggingToDefault | back to summary |
|---|---|
| public static void loggingToDefault() Mostly reverse the effects of | |
| main | back to summary |
|---|---|
| public static void main(String[] args) Main Jython program, following the structure and logic of CPython
The main difference for the caller stems from a difference between C and Java: in C, the
argument list
| |
| optionNotSupported | back to summary |
|---|---|
| private static void optionNotSupported(char option) Non-fatal error message when ignoring unsupported option (usually one valid for CPython). | |
| printError | back to summary |
|---|---|
| private static void printError(String format, Object... args) Print | |
| run | back to summary |
|---|---|
| public static void run(String[] args)
Deprecated
Now equivalent to
| |
| runFile | back to summary |
|---|---|
| private static jython. Attempt to open the named file and execute it in the interpreter as
| |
| runJar | back to summary |
|---|---|
| public static int runJar(String filename) Runs a JAR file, by executing the code found in the file __run__.py, which should be in the
root of the JAR archive. Note that
| |
| runMainFromImporter | back to summary |
|---|---|
| private static jython. Attempt to treat a file as a source of imports, import a module | |
| runModule | back to summary |
|---|---|
| private static jython. Attempt to run a module as the
| |
| runSimpleFile | back to summary |
|---|---|
| private static jython. Execute the stream
| |
| runStartupFile | back to summary |
|---|---|
| private static void runStartupFile(InteractiveConsole interp) Attempt to execute the file named in the registry entry
| |
| runStream | back to summary |
|---|---|
| private static jython. Execute the stream
| |
| usage | back to summary |
|---|---|
| pack-priv static jython. Print a full usage message onto | |
Options as the parser runs, while others set values in
(an instance) of this class.
| Modifier and Type | Class and Description |
|---|---|
| pack-priv static enum | jython.
Possible actions to take after processing the options. |
| Modifier and Type | Field and Description |
|---|---|
| pack-priv jython. | action
The action to take after processing the options. |
| pack-priv List | argv
Arguments after the first non-option, therefore arguments to the executable program. |
| pack-priv String | command
Argument to the -c option. |
| pack-priv String | filename
First argument that is not an option (therefore the executable file). |
| pack-priv boolean | help
-h or --help option. |
| pack-priv boolean | jar
-jar option. |
| pack-priv static final char | JAR_OPTION
Valid long-name options. |
| pack-priv String | |
| pack-priv String | module
Argument to the -m option. |
| pack-priv static final OptionScanner. | |
| pack-priv static final String | PROGRAM_OPTS
Valid single character options. |
| pack-priv Properties | properties
Collects definitions made with the -D option directly to Jython (not java -D). |
| pack-priv int | verbosity
Count of -v options. |
| pack-priv boolean | version
-V or --version option. |
| pack-priv List | warnoptions
Arguments collected from succesive -W options. |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| private void | |
| private void | _parse(OptionScanner scanner, String[] args)
Parse options into object state, until we encounter the first argument. |
| private void | error(String message, Object... args)
Set the error message as |
| private void | |
| pack-priv static jython. |
| action | back to summary |
|---|---|
| pack-priv jython. The action to take after processing the options. | |
| argv | back to summary |
|---|---|
| pack-priv List<String> argv Arguments after the first non-option, therefore arguments to the executable program. | |
| command | back to summary |
|---|---|
| pack-priv String command Argument to the -c option. | |
| filename | back to summary |
|---|---|
| pack-priv String filename First argument that is not an option (therefore the executable file). | |
| help | back to summary |
|---|---|
| pack-priv boolean help -h or --help option. | |
| jar | back to summary |
|---|---|
| pack-priv boolean jar -jar option. | |
| JAR_OPTION | back to summary |
|---|---|
| pack-priv static final char JAR_OPTION Valid long-name options. | |
| message | back to summary |
|---|---|
| pack-priv String message Set informatively when | |
| module | back to summary |
|---|---|
| pack-priv String module Argument to the -m option. | |
| PROGRAM_LONG_OPTS | back to summary |
|---|---|
| pack-priv static final OptionScanner. | |
| PROGRAM_OPTS | back to summary |
|---|---|
| pack-priv static final String PROGRAM_OPTS Valid single character options. ':' means expect an argument following. | |
| properties | back to summary |
|---|---|
| pack-priv Properties properties Collects definitions made with the -D option directly to Jython (not java -D). | |
| verbosity | back to summary |
|---|---|
| pack-priv int verbosity Count of -v options. | |
| version | back to summary |
|---|---|
| pack-priv boolean version -V or --version option. | |
| warnoptions | back to summary |
|---|---|
| pack-priv List<String> warnoptions Arguments collected from succesive -W options. | |
| CommandLineOptions | back to summary |
|---|---|
| pack-priv CommandLineOptions() | |
| _parse | back to summary |
|---|---|
| private void _parse(String[] args) Parser implementation. Do not call this twice on the same instance. | |
| _parse | back to summary |
|---|---|
| private void _parse(OptionScanner scanner, String[] args) Parse options into object state, until we encounter the first argument. This is a helper
to | |
| error | back to summary |
|---|---|
| private void error(String message, Object... args) Set the error message as | |
| optionD | back to summary |
|---|---|
| private void optionD(OptionScanner scanner) throws SecurityException Helper for option | |
| parse | back to summary |
|---|---|
| pack-priv static jython. Parse the arguments into the static
| |
| Modifier and Type | Field and Description |
|---|---|
| public static final jython. | |
| public static final jython. | |
| public static final jython. | |
| public static final jython. |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public static jython. | |
| public static jython. |
| ERROR | back to summary |
|---|---|
| public static final jython. | |
| HELP | back to summary |
|---|---|
| public static final jython. | |
| RUN | back to summary |
|---|---|
| public static final jython. | |
| VERSION | back to summary |
|---|---|
| public static final jython. | |
| Action | back to summary |
|---|---|
| private Action() | |
| valueOf | back to summary |
|---|---|
| public static jython. | |
| values | back to summary |
|---|---|
| public static jython. | |
OK.ordinal()==0
| Modifier and Type | Field and Description |
|---|---|
| public static final jython. | |
| public static final jython. | |
| public static final jython. | |
| public static final jython. |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public static jython. | |
| public static jython. |
| ERROR | back to summary |
|---|---|
| public static final jython. | |
| NO_FILE | back to summary |
|---|---|
| public static final jython. | |
| NOT_RUN | back to summary |
|---|---|
| public static final jython. | |
| OK | back to summary |
|---|---|
| public static final jython. | |
| Status | back to summary |
|---|---|
| private Status() | |
| valueOf | back to summary |
|---|---|
| public static jython. | |
| values | back to summary |
|---|---|
| public static jython. | |