The sys Interpreter Module

The sys module contains interpreter-related exports. It also provides access to some environment components, such as the command line, standard streams, and so on.

argv

Command-line argument strings list: [command, arguments...]. Like C’s argv array.

byteorder

Indicates the native byte-order (e.g., big for big-endian). New in 2.0.

builtin_module_names

Tuple of string names of C modules compiled into this Python interpreter.

copyright

String containing the Python interpreter copyright.

dllhandle

Python DLL integer handle; Windows only (see the Python Library Reference).

displayhook(func)

Called by Python to display results in interactive sessions; assign sys.displayhook to a one-argument function to customize output.

_ _displayhook_ _

Original value of displayhook (for restores).

excepthook(type, value, traceback)

Called by Python to display exception details to stderr; assign sys.excepthook to a three-argument function to customize exception displays.

_ _excepthook_ _

Original value of excepthook (for restores).

exc_info( )

Returns tuple of three values describing the exception currently being handled: (type, value, traceback). Specific to current thread. Subsumes exc_type, exc_value, and exc_traceback in Python 1.5 and later.

exc_type

Type of exception being handled (when an exception has been raised). Not thread-specific.

exc_value

Exception’s parameter (second argument to raise). Not thread-specific.

exc_traceback

Exception’s traceback object. Not thread-specific. ...

Get Python Pocket Reference, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.