<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html><head><title>Python: built-in module sys</title>
</head><body bgcolor="#f0f0f8">
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="heading">
<tr bgcolor="#7799ee">
<td valign=bottom> <br>
<font color="#ffffff" face="helvetica, arial"> <br><big><big><strong>sys</strong></big></big></font></td
><td align=right valign=bottom
><font color="#ffffff" face="helvetica, arial"><a href=".">index</a><br>(built-in)<br><a href="http://docs.python.org/library/sys">Module Docs</a></font></td></tr></table>
<p><tt>This module provides access to some objects used or maintained by the<br>
interpreter and to functions that interact strongly with the interpreter.<br>
<br>
Dynamic objects:<br>
<br>
argv -- command line arguments; argv[0] is the script pathname if known<br>
path -- module search path; path[0] is the script directory, else ''<br>
modules -- dictionary of loaded modules<br>
<br>
displayhook -- called to show results in an interactive session<br>
excepthook -- called to handle any uncaught exception other than SystemExit<br>
To customize printing in an interactive session or to install a custom<br>
top-level exception handler, assign other functions to replace these.<br>
<br>
exitfunc -- if sys.exitfunc exists, this routine is called when Python exits<br>
Assigning to sys.exitfunc is deprecated; use the atexit module instead.<br>
<br>
stdin -- standard input file object; used by raw_input() and input()<br>
stdout -- standard output file object; used by the print statement<br>
stderr -- standard error object; used for error messages<br>
By assigning other file objects (or objects that behave like files)<br>
to these, it is possible to redirect all of the interpreter's I/O.<br>
<br>
last_type -- type of last uncaught exception<br>
last_value -- value of last uncaught exception<br>
last_traceback -- traceback of last uncaught exception<br>
These three are only available in an interactive session after a<br>
traceback has been printed.<br>
<br>
exc_type -- type of exception currently being handled<br>
exc_value -- value of exception currently being handled<br>
exc_traceback -- traceback of exception currently being handled<br>
The function <a href="#-exc_info">exc_info</a>() should be used instead of these three,<br>
because it is thread-safe.<br>
<br>
Static objects:<br>
<br>
maxint -- the largest supported integer (the smallest is -maxint-1)<br>
maxsize -- the largest supported length of containers.<br>
maxunicode -- the largest supported character<br>
builtin_module_names -- tuple of module names built into this interpreter<br>
version -- the version of this interpreter as a string<br>
version_info -- version information as a tuple<br>
hexversion -- version information encoded as a single integer<br>
copyright -- copyright notice pertaining to this interpreter<br>
platform -- platform identifier<br>
executable -- pathname of this Python interpreter<br>
prefix -- prefix used to find the Python library<br>
exec_prefix -- prefix used to find the machine-specific Python library<br>
__stdin__ -- the original stdin; don't touch!<br>
__stdout__ -- the original stdout; don't touch!<br>
__stderr__ -- the original stderr; don't touch!<br>
__displayhook__ -- the original displayhook; don't touch!<br>
__excepthook__ -- the original excepthook; don't touch!<br>
<br>
Functions:<br>
<br>
<a href="#-displayhook">displayhook</a>() -- print an object to the screen, and save it in __builtin__._<br>
<a href="#-excepthook">excepthook</a>() -- print an exception and its traceback to sys.stderr<br>
<a href="#-exc_info">exc_info</a>() -- return thread-safe information about the current exception<br>
<a href="#-exc_clear">exc_clear</a>() -- clear the exception state for the current thread<br>
<a href="#-exit">exit</a>() -- exit the interpreter by raising SystemExit<br>
<a href="#-getdlopenflags">getdlopenflags</a>() -- returns flags to be used for dlopen() calls<br>
<a href="#-getprofile">getprofile</a>() -- get the global profiling function<br>
<a href="#-getrefcount">getrefcount</a>() -- return the reference count for an object (plus one :-)<br>
<a href="#-getrecursionlimit">getrecursionlimit</a>() -- return the max recursion depth for the interpreter<br>
<a href="#-getsizeof">getsizeof</a>() -- return the size of an object in bytes<br>
<a href="#-gettrace">gettrace</a>() -- get the global debug tracing function<br>
<a href="#-setcheckinterval">setcheckinterval</a>() -- control how often the interpreter checks for events<br>
<a href="#-setdlopenflags">setdlopenflags</a>() -- set the flags to be used for dlopen() calls<br>
<a href="#-setprofile">setprofile</a>() -- set the global profiling function<br>
<a href="#-setrecursionlimit">setrecursionlimit</a>() -- set the max recursion depth for the interpreter<br>
<a href="#-settrace">settrace</a>() -- set the global debug tracing function</tt></p>
<p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#eeaa77">
<td colspan=3 valign=bottom> <br>
<font color="#ffffff" face="helvetica, arial"><big><strong>Functions</strong></big></font></td></tr>
<tr><td bgcolor="#eeaa77"><tt> </tt></td><td> </td>
<td width="100%"><dl><dt><a name="-__displayhook__"><strong>__displayhook__</strong></a> = displayhook(...)</dt><dd><tt><a href="#-displayhook">displayhook</a>(object) -> None<br>
<br>
Print an object to sys.stdout and also save it in __builtin__.</tt></dd></dl>
<dl><dt><a name="-__excepthook__"><strong>__excepthook__</strong></a> = excepthook(...)</dt><dd><tt><a href="#-excepthook">excepthook</a>(exctype, value, traceback) -> None<br>
<br>
Handle an exception by displaying it with a traceback on sys.stderr.</tt></dd></dl>
<dl><dt><a name="-call_tracing"><strong>call_tracing</strong></a>(...)</dt><dd><tt><a href="#-call_tracing">call_tracing</a>(func, args) -> object<br>
<br>
Call func(*args), while tracing is enabled. The tracing state is<br>
saved, and restored afterwards. This is intended to be called from<br>
a debugger from a checkpoint, to recursively debug some other code.</tt></dd></dl>
<dl><dt><a name="-callstats"><strong>callstats</strong></a>(...)</dt><dd><tt><a href="#-callstats">callstats</a>() -> tuple of integers<br>
<br>
Return a tuple of function call statistics, if CALL_PROFILE was defined<br>
when Python was built. Otherwise, return None.<br>
<br>
When enabled, this function returns detailed, implementation-specific<br>
details about the number of function calls executed. The return value is<br>
a 11-tuple where the entries in the tuple are counts of:<br>
0. all function calls<br>
1. calls to PyFunction_Type objects<br>
2. PyFunction calls that do not create an argument tuple<br>
3. PyFunction calls that do not create an argument tuple<br>
and bypass PyEval_EvalCodeEx()<br>
4. PyMethod calls<br>
5. PyMethod calls on bound methods<br>
6. PyType calls<br>
7. PyCFunction calls<br>
8. generator calls<br>
9. All other calls<br>
10. Number of stack pops performed by call_function()</tt></dd></dl>
<dl><dt><a name="-displayhook"><strong>displayhook</strong></a>(...)</dt><dd><tt><a href="#-displayhook">displayhook</a>(object) -> None<br>
<br>
Print an object to sys.stdout and also save it in __builtin__.</tt></dd></dl>
<dl><dt><a name="-exc_clear"><strong>exc_clear</strong></a>(...)</dt><dd><tt><a href="#-exc_clear">exc_clear</a>() -> None<br>
<br>
Clear global information on the current exception. Subsequent calls to<br>
<a href="#-exc_info">exc_info</a>() will return (None,None,None) until another exception is raised<br>
in the current thread or the execution stack returns to a frame where<br>
another exception is being handled.</tt></dd></dl>
<dl><dt><a name="-exc_info"><strong>exc_info</strong></a>(...)</dt><dd><tt><a href="#-exc_info">exc_info</a>() -> (type, value, traceback)<br>
<br>
Return information about the most recent exception caught by an except<br>
clause in the current stack frame or in an older stack frame.</tt></dd></dl>
<dl><dt><a name="-excepthook"><strong>excepthook</strong></a>(...)</dt><dd><tt><a href="#-excepthook">excepthook</a>(exctype, value, traceback) -> None<br>
<br>
Handle an exception by displaying it with a traceback on sys.stderr.</tt></dd></dl>
<dl><dt><a name="-exit"><strong>exit</strong></a>(...)</dt><dd><tt><a href="#-exit">exit</a>([status])<br>
<br>
Exit the interpreter by raising SystemExit(status).<br>
If the status is omitted or None, it defaults to zero (i.e., success).<br>
If the status is numeric, it will be used as the system exit status.<br>
If it is another kind of object, it will be printed and the system<br>
exit status will be one (i.e., failure).</tt></dd></dl>
<dl><dt><a name="-getcheckinterval"><strong>getcheckinterval</strong></a>(...)</dt><dd><tt><a href="#-getcheckinterval">getcheckinterval</a>() -> current check interval; see <a href="#-setcheckinterval">setcheckinterval</a>().</tt></dd></dl>
<dl><dt><a name="-getdefaultencoding"><strong>getdefaultencoding</strong></a>(...)</dt><dd><tt><a href="#-getdefaultencoding">getdefaultencoding</a>() -> string<br>
<br>
Return the current default string encoding used by the Unicode <br>
implementation.</tt></dd></dl>
<dl><dt><a name="-getdlopenflags"><strong>getdlopenflags</strong></a>(...)</dt><dd><tt><a href="#-getdlopenflags">getdlopenflags</a>() -> int<br>
<br>
Return the current value of the flags that are used for dlopen()<br>
calls. The flag constants are defined in the dl module.</tt></dd></dl>
<dl><dt><a name="-getfilesystemencoding"><strong>getfilesystemencoding</strong></a>(...)</dt><dd><tt><a href="#-getfilesystemencoding">getfilesystemencoding</a>() -> string<br>
<br>
Return the encoding used to convert Unicode filenames in<br>
operating system filenames.</tt></dd></dl>
<dl><dt><a name="-getprofile"><strong>getprofile</strong></a>(...)</dt><dd><tt><a href="#-getprofile">getprofile</a>()<br>
<br>
Return the profiling function set with sys.setprofile.<br>
See the profiler chapter in the library manual.</tt></dd></dl>
<dl><dt><a name="-getrecursionlimit"><strong>getrecursionlimit</strong></a>(...)</dt><dd><tt><a href="#-getrecursionlimit">getrecursionlimit</a>()<br>
<br>
Return the current value of the recursion limit, the maximum depth<br>
of the Python interpreter stack. This limit prevents infinite<br>
recursion from causing an overflow of the C stack and crashing Python.</tt></dd></dl>
<dl><dt><a name="-getrefcount"><strong>getrefcount</strong></a>(...)</dt><dd><tt><a href="#-getrefcount">getrefcount</a>(object) -> integer<br>
<br>
Return the reference count of object. The count returned is generally<br>
one higher than you might expect, because it includes the (temporary)<br>
reference as an argument to <a href="#-getrefcount">getrefcount</a>().</tt></dd></dl>
<dl><dt><a name="-getsizeof"><strong>getsizeof</strong></a>(...)</dt><dd><tt><a href="#-getsizeof">getsizeof</a>(object, default) -> int<br>
<br>
Return the size of object in bytes.</tt></dd></dl>
<dl><dt><a name="-gettrace"><strong>gettrace</strong></a>(...)</dt><dd><tt><a href="#-gettrace">gettrace</a>()<br>
<br>
Return the global debug tracing function set with sys.settrace.<br>
See the debugger chapter in the library manual.</tt></dd></dl>
<dl><dt><a name="-setcheckinterval"><strong>setcheckinterval</strong></a>(...)</dt><dd><tt><a href="#-setcheckinterval">setcheckinterval</a>(n)<br>
<br>
Tell the Python interpreter to check for asynchronous events every<br>
n instructions. This also affects how often thread switches occur.</tt></dd></dl>
<dl><dt><a name="-setdlopenflags"><strong>setdlopenflags</strong></a>(...)</dt><dd><tt><a href="#-setdlopenflags">setdlopenflags</a>(n) -> None<br>
<br>
Set the flags that will be used for dlopen() calls. Among other<br>
things, this will enable a lazy resolving of symbols when importing<br>
a module, if called as sys.<a href="#-setdlopenflags">setdlopenflags</a>(0)<br>
To share symbols across extension modules, call as<br>
sys.<a href="#-setdlopenflags">setdlopenflags</a>(dl.RTLD_NOW|dl.RTLD_GLOBAL)</tt></dd></dl>
<dl><dt><a name="-setprofile"><strong>setprofile</strong></a>(...)</dt><dd><tt><a href="#-setprofile">setprofile</a>(function)<br>
<br>
Set the profiling function. It will be called on each function call<br>
and return. See the profiler chapter in the library manual.</tt></dd></dl>
<dl><dt><a name="-setrecursionlimit"><strong>setrecursionlimit</strong></a>(...)</dt><dd><tt><a href="#-setrecursionlimit">setrecursionlimit</a>(n)<br>
<br>
Set the maximum depth of the Python interpreter stack to n. This<br>
limit prevents infinite recursion from causing an overflow of the C<br>
stack and crashing Python. The highest possible limit is platform-<br>
dependent.</tt></dd></dl>
<dl><dt><a name="-settrace"><strong>settrace</strong></a>(...)</dt><dd><tt><a href="#-settrace">settrace</a>(function)<br>
<br>
Set the global debug tracing function. It will be called on each<br>
function call. See the debugger chapter in the library manual.</tt></dd></dl>
</td></tr></table><p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#55aa55">
<td colspan=3 valign=bottom> <br>
<font color="#ffffff" face="helvetica, arial"><big><strong>Data</strong></big></font></td></tr>
<tr><td bgcolor="#55aa55"><tt> </tt></td><td> </td>
<td width="100%"><strong>__stderr__</strong> = <open file '<stderr>', mode 'w' at 0x7fdbe72451c8><br>
<strong>__stdin__</strong> = <open file '<stdin>', mode 'r' at 0x7fdbe72450b8><br>
<strong>__stdout__</strong> = <open file '<stdout>', mode 'w' at 0x7fdbe7245140><br>
<strong>api_version</strong> = 1013<br>
<strong>argv</strong> = ['./make_doc.py']<br>
<strong>builtin_module_names</strong> = ('__builtin__', '__main__', '_ast', '_codecs', '_sre', '_symtable', '_warnings', 'errno', 'exceptions', 'gc', 'imp', 'marshal', 'posix', 'pwd', 'signal', 'sys', 'thread', 'xxsubtype', 'zipimport')<br>
<strong>byteorder</strong> = 'little'<br>
<strong>copyright</strong> = 'Copyright (c) 2001-2009 Python Software Foundati...ematisch Centrum, Amsterdam.<font color="#c040c0">\n</font>All Rights Reserved.'<br>
<strong>dont_write_bytecode</strong> = False<br>
<strong>exc_value</strong> = TypeError('arg is a built-in module',)<br>
<strong>exec_prefix</strong> = '/usr'<br>
<strong>executable</strong> = '/usr/bin/python'<br>
<strong>flags</strong> = sys.flags(debug=0, py3k_warning=0, division_warn...abcheck=0, verbose=0, unicode=0, bytes_warning=0)<br>
<strong>float_info</strong> = sys.floatinfo(max=1.7976931348623157e+308, max_e...psilon=2.2204460492503131e-16, radix=2, rounds=1)<br>
<strong>hexversion</strong> = 33948912<br>
<strong>maxint</strong> = 9223372036854775807<br>
<strong>maxsize</strong> = 9223372036854775807<br>
<strong>maxunicode</strong> = 65535<br>
<strong>meta_path</strong> = []<br>
<strong>modules</strong> = {'UserDict': <module 'UserDict' from '/usr/lib/python2.6/UserDict.pyc'>, '__builtin__': <module '__builtin__' (built-in)>, '__future__': <module '__future__' from '/usr/lib/python2.6/__future__.pyc'>, '__main__': <module '__main__' from './make_doc.py'>, '_abcoll': <module '_abcoll' from '/usr/lib/python2.6/_abcoll.pyc'>, '_codecs': <module '_codecs' (built-in)>, '_collections': <module '_collections' from '/usr/lib/python2.6/lib-dynload/_collections.so'>, '_curses': <module '_curses' from '/usr/lib/python2.6/lib-dynload/_curses.so'>, '_random': <module '_random' from '/usr/lib/python2.6/lib-dynload/_random.so'>, '_socket': <module '_socket' from '/usr/lib/python2.6/lib-dynload/_socket.so'>, ...}<br>
<strong>path</strong> = ['/home/hut/.ranger', '/home/hut/ranger', '/usr/lib/python26.zip', '/usr/lib/python2.6', '/usr/lib/python2.6/plat-linux2', '/usr/lib/python2.6/lib-tk', '/usr/lib/python2.6/lib-old', '/usr/lib/python2.6/lib-dynload', '/usr/lib/python2.6/site-packages', '/usr/lib/python2.6/site-packages/PIL', '/usr/lib/python2.6/site-packages/gst-0.10', '/usr/lib/python2.6/site-packages/gtk-2.0', '/home/hut/.ranger']<br>
<strong>path_hooks</strong> = [<type 'zipimport.zipimporter'>]<br>
<strong>path_importer_cache</strong> = {'.': None, './make_doc.py': <imp.NullImporter object at 0x7fdbe71e8080>, '/home/hut/.ranger': None, '/home/hut/.ranger/colorschemes': None, '/home/hut/ranger': None, '/home/hut/ranger/ranger': None, '/home/hut/ranger/ranger/api': None, '/home/hut/ranger/ranger/colorschemes': None, '/home/hut/ranger/ranger/container': None, '/home/hut/ranger/ranger/defaults': None, ...}<br>
<strong>platform</strong> = 'linux2'<br>
<strong>prefix</strong> = '/usr'<br>
<strong>py3kwarning</strong> = False<br>
<strong>stderr</strong> = <open file '<stderr>', mode 'w' at 0x7fdbe72451c8><br>
<strong>stdin</strong> = <open file '<stdin>', mode 'r' at 0x7fdbe72450b8><br>
<strong>stdout</strong> = <open file '<stdout>', mode 'w' at 0x7fdbe7245140><br>
<strong>subversion</strong> = ('CPython', 'tags/r264', '75706')<br>
<strong>version</strong> = '2.6.4 (r264:75706, Oct 27 2009, 06:25:13) <font color="#c040c0">\n</font>[GCC 4.4.1]'<br>
<strong>version_info</strong> = (2, 6, 4, 'final', 0)<br>
<strong>warnoptions</strong> = []</td></tr></table>
</body></html>