Sindbad~EG File Manager
<!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="X-UA-Compatible" content="IE=Edge" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>15.10. getpass — Portable password input — Python 2.7.16 documentation</title>
<link rel="stylesheet" href="../_static/classic.css" type="text/css" />
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
<script type="text/javascript" id="documentation_options" data-url_root="../" src="../_static/documentation_options.js"></script>
<script type="text/javascript" src="../_static/jquery.js"></script>
<script type="text/javascript" src="../_static/underscore.js"></script>
<script type="text/javascript" src="../_static/doctools.js"></script>
<script type="text/javascript" src="../_static/sidebar.js"></script>
<link rel="search" type="application/opensearchdescription+xml"
title="Search within Python 2.7.16 documentation"
href="../_static/opensearch.xml"/>
<link rel="author" title="About these documents" href="../about.html" />
<link rel="index" title="Index" href="../genindex.html" />
<link rel="search" title="Search" href="../search.html" />
<link rel="copyright" title="Copyright" href="../copyright.html" />
<link rel="next" title="15.11. curses — Terminal handling for character-cell displays" href="curses.html" />
<link rel="prev" title="15.9. logging.handlers — Logging handlers" href="logging.handlers.html" />
<link rel="shortcut icon" type="image/png" href="../_static/py.png" />
<link rel="canonical" href="https://docs.python.org/2/library/getpass.html" />
<script type="text/javascript" src="../_static/copybutton.js"></script>
</head><body>
<div class="related" role="navigation" aria-label="related navigation">
<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="../py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li class="right" >
<a href="curses.html" title="15.11. curses — Terminal handling for character-cell displays"
accesskey="N">next</a> |</li>
<li class="right" >
<a href="logging.handlers.html" title="15.9. logging.handlers — Logging handlers"
accesskey="P">previous</a> |</li>
<li><img src="../_static/py.png" alt=""
style="vertical-align: middle; margin-top: -1px"/></li>
<li><a href="https://www.python.org/">Python</a> »</li>
<li>
<a href="../index.html">Python 2.7.16 documentation</a> »
</li>
<li class="nav-item nav-item-1"><a href="index.html" >The Python Standard Library</a> »</li>
<li class="nav-item nav-item-2"><a href="allos.html" accesskey="U">15. Generic Operating System Services</a> »</li>
</ul>
</div>
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body" role="main">
<div class="section" id="module-getpass">
<span id="getpass-portable-password-input"></span><h1>15.10. <a class="reference internal" href="#module-getpass" title="getpass: Portable reading of passwords and retrieval of the userid."><code class="xref py py-mod docutils literal notranslate"><span class="pre">getpass</span></code></a> — Portable password input<a class="headerlink" href="#module-getpass" title="Permalink to this headline">¶</a></h1>
<p>The <a class="reference internal" href="#module-getpass" title="getpass: Portable reading of passwords and retrieval of the userid."><code class="xref py py-mod docutils literal notranslate"><span class="pre">getpass</span></code></a> module provides two functions:</p>
<dl class="function">
<dt id="getpass.getpass">
<code class="descclassname">getpass.</code><code class="descname">getpass</code><span class="sig-paren">(</span><span class="optional">[</span><em>prompt</em><span class="optional">[</span>, <em>stream</em><span class="optional">]</span><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#getpass.getpass" title="Permalink to this definition">¶</a></dt>
<dd><p>Prompt the user for a password without echoing. The user is prompted using the
string <em>prompt</em>, which defaults to <code class="docutils literal notranslate"><span class="pre">'Password:</span> <span class="pre">'</span></code>. On Unix, the prompt is
written to the file-like object <em>stream</em>. <em>stream</em> defaults to the
controlling terminal (/dev/tty) or if that is unavailable to <code class="docutils literal notranslate"><span class="pre">sys.stderr</span></code>
(this argument is ignored on Windows).</p>
<p>If echo free input is unavailable getpass() falls back to printing
a warning message to <em>stream</em> and reading from <code class="docutils literal notranslate"><span class="pre">sys.stdin</span></code> and
issuing a <a class="reference internal" href="#getpass.GetPassWarning" title="getpass.GetPassWarning"><code class="xref py py-exc docutils literal notranslate"><span class="pre">GetPassWarning</span></code></a>.</p>
<div class="versionchanged">
<p><span class="versionmodified">Changed in version 2.5: </span>The <em>stream</em> parameter was added.</p>
</div>
<div class="versionchanged">
<p><span class="versionmodified">Changed in version 2.6: </span>On Unix it defaults to using /dev/tty before falling back
to <code class="docutils literal notranslate"><span class="pre">sys.stdin</span></code> and <code class="docutils literal notranslate"><span class="pre">sys.stderr</span></code>.</p>
</div>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">If you call getpass from within IDLE, the input may be done in the
terminal you launched IDLE from rather than the idle window itself.</p>
</div>
</dd></dl>
<dl class="exception">
<dt id="getpass.GetPassWarning">
<em class="property">exception </em><code class="descclassname">getpass.</code><code class="descname">GetPassWarning</code><a class="headerlink" href="#getpass.GetPassWarning" title="Permalink to this definition">¶</a></dt>
<dd><p>A <a class="reference internal" href="exceptions.html#exceptions.UserWarning" title="exceptions.UserWarning"><code class="xref py py-exc docutils literal notranslate"><span class="pre">UserWarning</span></code></a> subclass issued when password input may be echoed.</p>
</dd></dl>
<dl class="function">
<dt id="getpass.getuser">
<code class="descclassname">getpass.</code><code class="descname">getuser</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#getpass.getuser" title="Permalink to this definition">¶</a></dt>
<dd><p>Return the “login name” of the user.</p>
<p>This function checks the environment variables <span class="target" id="index-0"></span><code class="xref std std-envvar docutils literal notranslate"><span class="pre">LOGNAME</span></code>,
<span class="target" id="index-1"></span><code class="xref std std-envvar docutils literal notranslate"><span class="pre">USER</span></code>, <span class="target" id="index-2"></span><code class="xref std std-envvar docutils literal notranslate"><span class="pre">LNAME</span></code> and <span class="target" id="index-3"></span><code class="xref std std-envvar docutils literal notranslate"><span class="pre">USERNAME</span></code>, in order, and returns
the value of the first one which is set to a non-empty string. If none are set,
the login name from the password database is returned on systems which support
the <a class="reference internal" href="pwd.html#module-pwd" title="pwd: The password database (getpwnam() and friends). (Unix)"><code class="xref py py-mod docutils literal notranslate"><span class="pre">pwd</span></code></a> module, otherwise, an exception is raised.</p>
</dd></dl>
</div>
</div>
</div>
</div>
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
<div class="sphinxsidebarwrapper">
<h4>Previous topic</h4>
<p class="topless"><a href="logging.handlers.html"
title="previous chapter">15.9. <code class="docutils literal notranslate"><span class="pre">logging.handlers</span></code> — Logging handlers</a></p>
<h4>Next topic</h4>
<p class="topless"><a href="curses.html"
title="next chapter">15.11. <code class="docutils literal notranslate"><span class="pre">curses</span></code> — Terminal handling for character-cell displays</a></p>
<div role="note" aria-label="source link">
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="../_sources/library/getpass.rst.txt"
rel="nofollow">Show Source</a></li>
</ul>
</div>
<div id="searchbox" style="display: none" role="search">
<h3>Quick search</h3>
<div class="searchformwrapper">
<form class="search" action="../search.html" method="get">
<input type="text" name="q" />
<input type="submit" value="Go" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
</div>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
</div>
</div>
<div class="clearer"></div>
</div>
<div class="related" role="navigation" aria-label="related navigation">
<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="../py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li class="right" >
<a href="curses.html" title="15.11. curses — Terminal handling for character-cell displays"
>next</a> |</li>
<li class="right" >
<a href="logging.handlers.html" title="15.9. logging.handlers — Logging handlers"
>previous</a> |</li>
<li><img src="../_static/py.png" alt=""
style="vertical-align: middle; margin-top: -1px"/></li>
<li><a href="https://www.python.org/">Python</a> »</li>
<li>
<a href="../index.html">Python 2.7.16 documentation</a> »
</li>
<li class="nav-item nav-item-1"><a href="index.html" >The Python Standard Library</a> »</li>
<li class="nav-item nav-item-2"><a href="allos.html" >15. Generic Operating System Services</a> »</li>
</ul>
</div>
<div class="footer">
© <a href="../copyright.html">Copyright</a> 1990-2019, Python Software Foundation.
<br />
The Python Software Foundation is a non-profit corporation.
<a href="https://www.python.org/psf/donations/">Please donate.</a>
<br />
Last updated on Mar 27, 2019.
<a href="../bugs.html">Found a bug</a>?
<br />
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.7.6.
</div>
</body>
</html>
Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists