<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Operating System Utilities — Python v2.6.6 documentation</title>
<link rel="stylesheet" href="../_static/default.css" type="text/css" />
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: '../',
VERSION: '2.6.6',
COLLAPSE_MODINDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
};
</script>
<script type="text/javascript" src="../_static/jquery.js"></script>
<script type="text/javascript" src="../_static/doctools.js"></script>
<link rel="search" type="application/opensearchdescription+xml"
title="Search within Python v2.6.6 documentation"
href="../_static/opensearch.xml"/>
<link rel="author" title="About these documents" href="../about.html" />
<link rel="copyright" title="Copyright" href="../copyright.html" />
<link rel="top" title="Python v2.6.6 documentation" href="../index.html" />
<link rel="up" title="Utilities" href="utilities.html" />
<link rel="next" title="Importing Modules" href="import.html" />
<link rel="prev" title="Utilities" href="utilities.html" />
<link rel="shortcut icon" type="image/png" href="../_static/py.png" />
</head>
<body>
<div class="related">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="../genindex.html" title="General Index"
accesskey="I">index</a></li>
<li class="right" >
<a href="../modindex.html" title="Global Module Index"
accesskey="M">modules</a> |</li>
<li class="right" >
<a href="import.html" title="Importing Modules"
accesskey="N">next</a> |</li>
<li class="right" >
<a href="utilities.html" title="Utilities"
accesskey="P">previous</a> |</li>
<li><img src="../_static/py.png" alt=""
style="vertical-align: middle; margin-top: -1px"/></li>
<li><a href="../index.html">Python v2.6.6 documentation</a> »</li>
<li><a href="index.html" >Python/C API Reference Manual</a> »</li>
<li><a href="utilities.html" accesskey="U">Utilities</a> »</li>
</ul>
</div>
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body">
<div class="section" id="operating-system-utilities">
<span id="os"></span><h1>Operating System Utilities<a class="headerlink" href="#operating-system-utilities" title="Permalink to this headline">¶</a></h1>
<dl class="cfunction">
<dt id="Py_FdIsInteractive">
int <tt class="descname">Py_FdIsInteractive</tt><big>(</big>FILE<em> *fp</em>, const char<em> *filename</em><big>)</big><a class="headerlink" href="#Py_FdIsInteractive" title="Permalink to this definition">¶</a></dt>
<dd>Return true (nonzero) if the standard I/O file <em>fp</em> with name <em>filename</em> is
deemed interactive. This is the case for files for which <tt class="docutils literal"><span class="pre">isatty(fileno(fp))</span></tt>
is true. If the global flag <tt class="xref docutils literal"><span class="pre">Py_InteractiveFlag</span></tt> is true, this function
also returns true if the <em>filename</em> pointer is <em>NULL</em> or if the name is equal to
one of the strings <tt class="docutils literal"><span class="pre">'<stdin>'</span></tt> or <tt class="docutils literal"><span class="pre">'???'</span></tt>.</dd></dl>
<dl class="cfunction">
<dt id="PyOS_GetLastModificationTime">
long <tt class="descname">PyOS_GetLastModificationTime</tt><big>(</big>char<em> *filename</em><big>)</big><a class="headerlink" href="#PyOS_GetLastModificationTime" title="Permalink to this definition">¶</a></dt>
<dd>Return the time of last modification of the file <em>filename</em>. The result is
encoded in the same way as the timestamp returned by the standard C library
function <tt class="xref docutils literal"><span class="pre">time()</span></tt>.</dd></dl>
<dl class="cfunction">
<dt id="PyOS_AfterFork">
void <tt class="descname">PyOS_AfterFork</tt><big>(</big><big>)</big><a class="headerlink" href="#PyOS_AfterFork" title="Permalink to this definition">¶</a></dt>
<dd>Function to update some internal state after a process fork; this should be
called in the new process if the Python interpreter will continue to be used.
If a new executable is loaded into the new process, this function does not need
to be called.</dd></dl>
<dl class="cfunction">
<dt id="PyOS_CheckStack">
int <tt class="descname">PyOS_CheckStack</tt><big>(</big><big>)</big><a class="headerlink" href="#PyOS_CheckStack" title="Permalink to this definition">¶</a></dt>
<dd>Return true when the interpreter runs out of stack space. This is a reliable
check, but is only available when <tt class="xref docutils literal"><span class="pre">USE_STACKCHECK</span></tt> is defined (currently
on Windows using the Microsoft Visual C++ compiler). <tt class="xref docutils literal"><span class="pre">USE_STACKCHECK</span></tt>
will be defined automatically; you should never change the definition in your
own code.</dd></dl>
<dl class="cfunction">
<dt id="PyOS_getsig">
PyOS_sighandler_t <tt class="descname">PyOS_getsig</tt><big>(</big>int<em> i</em><big>)</big><a class="headerlink" href="#PyOS_getsig" title="Permalink to this definition">¶</a></dt>
<dd>Return the current signal handler for signal <em>i</em>. This is a thin wrapper around
either <tt class="xref docutils literal"><span class="pre">sigaction()</span></tt> or <tt class="xref docutils literal"><span class="pre">signal()</span></tt>. Do not call those functions
directly! <tt class="xref docutils literal"><span class="pre">PyOS_sighandler_t</span></tt> is a typedef alias for <tt class="xref docutils literal"><span class="pre">void</span>
<span class="pre">(*)(int)</span></tt>.</dd></dl>
<dl class="cfunction">
<dt id="PyOS_setsig">
PyOS_sighandler_t <tt class="descname">PyOS_setsig</tt><big>(</big>int<em> i</em>, PyOS_sighandler_t<em> h</em><big>)</big><a class="headerlink" href="#PyOS_setsig" title="Permalink to this definition">¶</a></dt>
<dd>Set the signal handler for signal <em>i</em> to be <em>h</em>; return the old signal handler.
This is a thin wrapper around either <tt class="xref docutils literal"><span class="pre">sigaction()</span></tt> or <tt class="xref docutils literal"><span class="pre">signal()</span></tt>. Do
not call those functions directly! <tt class="xref docutils literal"><span class="pre">PyOS_sighandler_t</span></tt> is a typedef
alias for <tt class="xref docutils literal"><span class="pre">void</span> <span class="pre">(*)(int)</span></tt>.</dd></dl>
</div>
<div class="section" id="system-functions">
<span id="systemfunctions"></span><h1>System Functions<a class="headerlink" href="#system-functions" title="Permalink to this headline">¶</a></h1>
<p>These are utility functions that make functionality from the <a title="Access system-specific parameters and functions." class="reference external" href="../library/sys.html#module-sys"><tt class="xref docutils literal"><span class="pre">sys</span></tt></a> module
accessible to C code. They all work with the current interpreter thread’s
<a title="Access system-specific parameters and functions." class="reference external" href="../library/sys.html#module-sys"><tt class="xref docutils literal"><span class="pre">sys</span></tt></a> module’s dict, which is contained in the internal thread state structure.</p>
<dl class="cfunction">
<dt id="PySys_GetObject">
<a title="PyObject" class="reference external" href="structures.html#PyObject">PyObject</a> *<tt class="descname">PySys_GetObject</tt><big>(</big>char<em> *name</em><big>)</big><a class="headerlink" href="#PySys_GetObject" title="Permalink to this definition">¶</a></dt>
<dd><em class="refcount">Return value: Borrowed reference.</em><p>Return the object <em>name</em> from the <a title="Access system-specific parameters and functions." class="reference external" href="../library/sys.html#module-sys"><tt class="xref docutils literal"><span class="pre">sys</span></tt></a> module or <em>NULL</em> if it does
not exist, without setting an exception.</p>
</dd></dl>
<dl class="cfunction">
<dt id="PySys_GetFile">
FILE *<tt class="descname">PySys_GetFile</tt><big>(</big>char<em> *name</em>, FILE<em> *def</em><big>)</big><a class="headerlink" href="#PySys_GetFile" title="Permalink to this definition">¶</a></dt>
<dd>Return the <tt class="xref docutils literal"><span class="pre">FILE*</span></tt> associated with the object <em>name</em> in the
<a title="Access system-specific parameters and functions." class="reference external" href="../library/sys.html#module-sys"><tt class="xref docutils literal"><span class="pre">sys</span></tt></a> module, or <em>def</em> if <em>name</em> is not in the module or is not associated
with a <tt class="xref docutils literal"><span class="pre">FILE*</span></tt>.</dd></dl>
<dl class="cfunction">
<dt id="PySys_SetObject">
int <tt class="descname">PySys_SetObject</tt><big>(</big>char<em> *name</em>, <a title="PyObject" class="reference external" href="structures.html#PyObject">PyObject</a><em> *v</em><big>)</big><a class="headerlink" href="#PySys_SetObject" title="Permalink to this definition">¶</a></dt>
<dd>Set <em>name</em> in the <a title="Access system-specific parameters and functions." class="reference external" href="../library/sys.html#module-sys"><tt class="xref docutils literal"><span class="pre">sys</span></tt></a> module to <em>v</em> unless <em>v</em> is <em>NULL</em>, in which
case <em>name</em> is deleted from the sys module. Returns <tt class="docutils literal"><span class="pre">0</span></tt> on success, <tt class="docutils literal"><span class="pre">-1</span></tt>
on error.</dd></dl>
<dl class="cfunction">
<dt id="PySys_ResetWarnOptions">
void <tt class="descname">PySys_ResetWarnOptions</tt><big>(</big><big>)</big><a class="headerlink" href="#PySys_ResetWarnOptions" title="Permalink to this definition">¶</a></dt>
<dd>Reset <a title="sys.warnoptions" class="reference external" href="../library/sys.html#sys.warnoptions"><tt class="xref docutils literal"><span class="pre">sys.warnoptions</span></tt></a> to an empty list.</dd></dl>
<dl class="cfunction">
<dt id="PySys_AddWarnOption">
void <tt class="descname">PySys_AddWarnOption</tt><big>(</big>char<em> *s</em><big>)</big><a class="headerlink" href="#PySys_AddWarnOption" title="Permalink to this definition">¶</a></dt>
<dd>Append <em>s</em> to <a title="sys.warnoptions" class="reference external" href="../library/sys.html#sys.warnoptions"><tt class="xref docutils literal"><span class="pre">sys.warnoptions</span></tt></a>.</dd></dl>
<dl class="cfunction">
<dt id="PySys_SetPath">
void <tt class="descname">PySys_SetPath</tt><big>(</big>char<em> *path</em><big>)</big><a class="headerlink" href="#PySys_SetPath" title="Permalink to this definition">¶</a></dt>
<dd>Set <a title="sys.path" class="reference external" href="../library/sys.html#sys.path"><tt class="xref docutils literal"><span class="pre">sys.path</span></tt></a> to a list object of paths found in <em>path</em> which should
be a list of paths separated with the platform’s search path delimiter
(<tt class="docutils literal"><span class="pre">:</span></tt> on Unix, <tt class="docutils literal"><span class="pre">;</span></tt> on Windows).</dd></dl>
<dl class="cfunction">
<dt id="PySys_WriteStdout">
void <tt class="descname">PySys_WriteStdout</tt><big>(</big>const char<em> *format</em>, ...<big>)</big><a class="headerlink" href="#PySys_WriteStdout" title="Permalink to this definition">¶</a></dt>
<dd><p>Write the output string described by <em>format</em> to <a title="sys.stdout" class="reference external" href="../library/sys.html#sys.stdout"><tt class="xref docutils literal"><span class="pre">sys.stdout</span></tt></a>. No
exceptions are raised, even if truncation occurs (see below).</p>
<p><em>format</em> should limit the total size of the formatted output string to
1000 bytes or less – after 1000 bytes, the output string is truncated.
In particular, this means that no unrestricted “%s” formats should occur;
these should be limited using “%.<N>s” where <N> is a decimal number
calculated so that <N> plus the maximum size of other formatted text does not
exceed 1000 bytes. Also watch out for “%f”, which can print hundreds of
digits for very large numbers.</p>
<p>If a problem occurs, or <a title="sys.stdout" class="reference external" href="../library/sys.html#sys.stdout"><tt class="xref docutils literal"><span class="pre">sys.stdout</span></tt></a> is unset, the formatted message
is written to the real (C level) <em>stdout</em>.</p>
</dd></dl>
<dl class="cfunction">
<dt id="PySys_WriteStderr">
void <tt class="descname">PySys_WriteStderr</tt><big>(</big>const char<em> *format</em>, ...<big>)</big><a class="headerlink" href="#PySys_WriteStderr" title="Permalink to this definition">¶</a></dt>
<dd>As above, but write to <a title="sys.stderr" class="reference external" href="../library/sys.html#sys.stderr"><tt class="xref docutils literal"><span class="pre">sys.stderr</span></tt></a> or <em>stderr</em> instead.</dd></dl>
</div>
<div class="section" id="process-control">
<span id="processcontrol"></span><h1>Process Control<a class="headerlink" href="#process-control" title="Permalink to this headline">¶</a></h1>
<dl class="cfunction">
<dt id="Py_FatalError">
void <tt class="descname">Py_FatalError</tt><big>(</big>const char<em> *message</em><big>)</big><a class="headerlink" href="#Py_FatalError" title="Permalink to this definition">¶</a></dt>
<dd><p id="index-144">Print a fatal error message and kill the process. No cleanup is performed.
This function should only be invoked when a condition is detected that would
make it dangerous to continue using the Python interpreter; e.g., when the
object administration appears to be corrupted. On Unix, the standard C library
function <tt class="xref docutils literal"><span class="pre">abort()</span></tt> is called which will attempt to produce a <tt class="docutils literal"><span class="pre">core</span></tt>
file.</p>
</dd></dl>
<dl class="cfunction">
<dt id="Py_Exit">
void <tt class="descname">Py_Exit</tt><big>(</big>int<em> status</em><big>)</big><a class="headerlink" href="#Py_Exit" title="Permalink to this definition">¶</a></dt>
<dd><p id="index-145">Exit the current process. This calls <a title="Py_Finalize" class="reference external" href="init.html#Py_Finalize"><tt class="xref docutils literal"><span class="pre">Py_Finalize()</span></tt></a> and then calls the
standard C library function <tt class="docutils literal"><span class="pre">exit(status)</span></tt>.</p>
</dd></dl>
<dl class="cfunction">
<dt id="Py_AtExit">
int <tt class="descname">Py_AtExit</tt><big>(</big>void (*func)<em> ()</em><big>)</big><a class="headerlink" href="#Py_AtExit" title="Permalink to this definition">¶</a></dt>
<dd><p id="index-146">Register a cleanup function to be called by <a title="Py_Finalize" class="reference external" href="init.html#Py_Finalize"><tt class="xref docutils literal"><span class="pre">Py_Finalize()</span></tt></a>. The cleanup
function will be called with no arguments and should return no value. At most
32 cleanup functions can be registered. When the registration is successful,
<a title="Py_AtExit" class="reference internal" href="#Py_AtExit"><tt class="xref docutils literal"><span class="pre">Py_AtExit()</span></tt></a> returns <tt class="docutils literal"><span class="pre">0</span></tt>; on failure, it returns <tt class="docutils literal"><span class="pre">-1</span></tt>. The cleanup
function registered last is called first. Each cleanup function will be called
at most once. Since Python’s internal finalization will have completed before
the cleanup function, no Python APIs should be called by <em>func</em>.</p>
</dd></dl>
</div>
</div>
</div>
</div>
<div class="sphinxsidebar">
<div class="sphinxsidebarwrapper">
<h3><a href="../contents.html">Table Of Contents</a></h3>
<ul>
<li><a class="reference external" href="#">Operating System Utilities</a></li>
<li><a class="reference external" href="#system-functions">System Functions</a></li>
<li><a class="reference external" href="#process-control">Process Control</a></li>
</ul>
<h4>Previous topic</h4>
<p class="topless"><a href="utilities.html"
title="previous chapter">Utilities</a></p>
<h4>Next topic</h4>
<p class="topless"><a href="import.html"
title="next chapter">Importing Modules</a></p>
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="../bugs.html">Report a Bug</a></li>
<li><a href="../_sources/c-api/sys.txt"
rel="nofollow">Show Source</a></li>
</ul>
<div id="searchbox" style="display: none">
<h3>Quick search</h3>
<form class="search" action="../search.html" method="get">
<input type="text" name="q" size="18" />
<input type="submit" value="Go" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
<p class="searchtip" style="font-size: 90%">
Enter search terms or a module, class or function name.
</p>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
</div>
</div>
<div class="clearer"></div>
</div>
<div class="related">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="../genindex.html" title="General Index"
>index</a></li>
<li class="right" >
<a href="../modindex.html" title="Global Module Index"
>modules</a> |</li>
<li class="right" >
<a href="import.html" title="Importing Modules"
>next</a> |</li>
<li class="right" >
<a href="utilities.html" title="Utilities"
>previous</a> |</li>
<li><img src="../_static/py.png" alt=""
style="vertical-align: middle; margin-top: -1px"/></li>
<li><a href="../index.html">Python v2.6.6 documentation</a> »</li>
<li><a href="index.html" >Python/C API Reference Manual</a> »</li>
<li><a href="utilities.html" >Utilities</a> »</li>
</ul>
</div>
<div class="footer">
© <a href="../copyright.html">Copyright</a> 1990-2011, Python Software Foundation.
<br />
The Python Software Foundation is a non-profit corporation.
<a href="http://www.python.org/psf/donations/">Please donate.</a>
<br />
Last updated on Jul 20, 2011.
<a href="../bugs.html">Found a bug</a>?
<br />
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 0.6.6.
</div>
</body>
</html>
Copyright 2K16 - 2K18 Indonesian Hacker Rulez