Built-in Module sys

sys This module provides access to some variables used or maintained by the interpreter and to functions that interact strongly with the interpreter. It is always available.


\begin{datadesc}{argv}
The list of command line arguments passed to a Python sc...
...ssed to the Python interpreter,
\code{sys.argv} has zero length.
\end{datadesc}


\begin{datadesc}{builtin_module_names}
A list of strings giving the names of al...
... --- \code{sys.modules.keys()} only lists the imported
modules.)
\end{datadesc}


\begin{datadesc}{exc_type}
\dataline{exc_value}
\dataline{exc_traceback}
These ...
...int where the exception
originally occurred.
\obindex{traceback}
\end{datadesc}


\begin{funcdesc}{exit}{n}
Exit from Python with numeric exit status \var{n}. Th...
... and it is possible to catch the exit attempt at an outer
level.
\end{funcdesc}


\begin{datadesc}{exitfunc}
This value is not actually defined by the module, bu...
...n that case the interpreter's internal state
cannot be trusted).
\end{datadesc}


\begin{datadesc}{last_type}
\dataline{last_value}
\dataline{last_traceback}
The...
..._type}, \code{exc_value} and \code{exc_tracaback},
respectively.
\end{datadesc}


\begin{datadesc}{modules}
Gives the list of modules that have already been load...
...an be manipulated to force reloading of modules and other tricks.
\end{datadesc}


\begin{datadesc}{path}
A list of strings that specifies the search path for mod...
...ariable \code{PYTHONPATH}, or an
installation-dependent default.
\end{datadesc}


\begin{datadesc}{platform}
This string contains a platform identifier. This can ...
...nd platform-specific components to \code{sys.path}, for instance.
\end{datadesc}


\begin{datadesc}{ps1}
\dataline{ps2}
Strings specifying the primary and seconda...
...initial values in this case are
\code{'>>> '} and \code{'... '}.
\end{datadesc}


\begin{funcdesc}{setcheckinterval}{interval}
Set the interpreter's \lq\lq check inter...
...rtual instruction,
maximizing responsiveness as well as overhead.
\end{funcdesc}


\begin{funcdesc}{settrace}{tracefunc}
Set the system's trace function, which al...
... section \lq\lq How It Works''
in the chapter on the Python Debugger.
\end{funcdesc}


\begin{funcdesc}{setprofile}{profilefunc}
Set the system's profile function, wh...
... its return value is not used, so it can just return \code{None}.
\end{funcdesc}


\begin{datadesc}{stdin}
\dataline{stdout}
\dataline{stderr}
File objects corres...
...)}
family of functions in the \code{os} module.)
\stmodindex{os}
\end{datadesc}


\begin{datadesc}{tracebacklimit}
When this variable is set to an integer value, ...
... is suppressed and only the exception
type and value are printed.
\end{datadesc}