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...
... was passed to the Python interpreter,
\code{sys.argv} is empty.
\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 ...
...call stack at the point where the exception
originally occurred.
\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}{ps1}
\dataline{ps2}
Strings specifying the primary and seconda...
...initial values in this case are
\code{'>>> '} and \code{'... '}.
\end{datadesc}


\begin{funcdesc}{settrace}{tracefunc}
Set the system's trace function, which al...
...more documentation (both
about \code{pdb} and \code{sys.trace}).
\end{funcdesc}
pdb wdb


\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...
...ng as it has
a \code{write} method that takes a string argument.
\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}