gooderp18绿色标准版
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

438 lines
27KB

  1. <!DOCTYPE html>
  2. <html lang="en" data-content_root="../">
  3. <head>
  4. <meta charset="utf-8" />
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="viewport" content="width=device-width, initial-scale=1" />
  6. <meta property="og:title" content="pty — Pseudo-terminal utilities" />
  7. <meta property="og:type" content="website" />
  8. <meta property="og:url" content="https://docs.python.org/3/library/pty.html" />
  9. <meta property="og:site_name" content="Python documentation" />
  10. <meta property="og:description" content="Source code: Lib/pty.py The pty module defines operations for handling the pseudo-terminal concept: starting another process and being able to write to and read from its controlling terminal progra..." />
  11. <meta property="og:image" content="https://docs.python.org/3/_static/og-image.png" />
  12. <meta property="og:image:alt" content="Python documentation" />
  13. <meta name="description" content="Source code: Lib/pty.py The pty module defines operations for handling the pseudo-terminal concept: starting another process and being able to write to and read from its controlling terminal progra..." />
  14. <meta property="og:image:width" content="200" />
  15. <meta property="og:image:height" content="200" />
  16. <meta name="theme-color" content="#3776ab" />
  17. <title>pty — Pseudo-terminal utilities &#8212; Python 3.12.3 documentation</title><meta name="viewport" content="width=device-width, initial-scale=1.0">
  18. <link rel="stylesheet" type="text/css" href="../_static/pygments.css?v=80d5e7a1" />
  19. <link rel="stylesheet" type="text/css" href="../_static/pydoctheme.css?v=bb723527" />
  20. <link id="pygments_dark_css" media="(prefers-color-scheme: dark)" rel="stylesheet" type="text/css" href="../_static/pygments_dark.css?v=b20cc3f5" />
  21. <script src="../_static/documentation_options.js?v=2c828074"></script>
  22. <script src="../_static/doctools.js?v=888ff710"></script>
  23. <script src="../_static/sphinx_highlight.js?v=dc90522c"></script>
  24. <script src="../_static/sidebar.js"></script>
  25. <link rel="search" type="application/opensearchdescription+xml"
  26. title="Search within Python 3.12.3 documentation"
  27. href="../_static/opensearch.xml"/>
  28. <link rel="author" title="About these documents" href="../about.html" />
  29. <link rel="index" title="Index" href="../genindex.html" />
  30. <link rel="search" title="Search" href="../search.html" />
  31. <link rel="copyright" title="Copyright" href="../copyright.html" />
  32. <link rel="next" title="fcntl — The fcntl and ioctl system calls" href="fcntl.html" />
  33. <link rel="prev" title="tty — Terminal control functions" href="tty.html" />
  34. <link rel="canonical" href="https://docs.python.org/3/library/pty.html" />
  35. <style>
  36. @media only screen {
  37. table.full-width-table {
  38. width: 100%;
  39. }
  40. }
  41. </style>
  42. <link rel="stylesheet" href="../_static/pydoctheme_dark.css" media="(prefers-color-scheme: dark)" id="pydoctheme_dark_css">
  43. <link rel="shortcut icon" type="image/png" href="../_static/py.svg" />
  44. <script type="text/javascript" src="../_static/copybutton.js"></script>
  45. <script type="text/javascript" src="../_static/menu.js"></script>
  46. <script type="text/javascript" src="../_static/search-focus.js"></script>
  47. <script type="text/javascript" src="../_static/themetoggle.js"></script>
  48. </head>
  49. <body>
  50. <div class="mobile-nav">
  51. <input type="checkbox" id="menuToggler" class="toggler__input" aria-controls="navigation"
  52. aria-pressed="false" aria-expanded="false" role="button" aria-label="Menu" />
  53. <nav class="nav-content" role="navigation">
  54. <label for="menuToggler" class="toggler__label">
  55. <span></span>
  56. </label>
  57. <span class="nav-items-wrapper">
  58. <a href="https://www.python.org/" class="nav-logo">
  59. <img src="../_static/py.svg" alt="Python logo"/>
  60. </a>
  61. <span class="version_switcher_placeholder"></span>
  62. <form role="search" class="search" action="../search.html" method="get">
  63. <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" class="search-icon">
  64. <path fill-rule="nonzero" fill="currentColor" d="M15.5 14h-.79l-.28-.27a6.5 6.5 0 001.48-5.34c-.47-2.78-2.79-5-5.59-5.34a6.505 6.505 0 00-7.27 7.27c.34 2.8 2.56 5.12 5.34 5.59a6.5 6.5 0 005.34-1.48l.27.28v.79l4.25 4.25c.41.41 1.08.41 1.49 0 .41-.41.41-1.08 0-1.49L15.5 14zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z"></path>
  65. </svg>
  66. <input placeholder="Quick search" aria-label="Quick search" type="search" name="q" />
  67. <input type="submit" value="Go"/>
  68. </form>
  69. </span>
  70. </nav>
  71. <div class="menu-wrapper">
  72. <nav class="menu" role="navigation" aria-label="main navigation">
  73. <div class="language_switcher_placeholder"></div>
  74. <label class="theme-selector-label">
  75. Theme
  76. <select class="theme-selector" oninput="activateTheme(this.value)">
  77. <option value="auto" selected>Auto</option>
  78. <option value="light">Light</option>
  79. <option value="dark">Dark</option>
  80. </select>
  81. </label>
  82. <div>
  83. <h3><a href="../contents.html">Table of Contents</a></h3>
  84. <ul>
  85. <li><a class="reference internal" href="#"><code class="xref py py-mod docutils literal notranslate"><span class="pre">pty</span></code> — Pseudo-terminal utilities</a><ul>
  86. <li><a class="reference internal" href="#example">Example</a></li>
  87. </ul>
  88. </li>
  89. </ul>
  90. </div>
  91. <div>
  92. <h4>Previous topic</h4>
  93. <p class="topless"><a href="tty.html"
  94. title="previous chapter"><code class="xref py py-mod docutils literal notranslate"><span class="pre">tty</span></code> — Terminal control functions</a></p>
  95. </div>
  96. <div>
  97. <h4>Next topic</h4>
  98. <p class="topless"><a href="fcntl.html"
  99. title="next chapter"><code class="xref py py-mod docutils literal notranslate"><span class="pre">fcntl</span></code> — The <code class="docutils literal notranslate"><span class="pre">fcntl</span></code> and <code class="docutils literal notranslate"><span class="pre">ioctl</span></code> system calls</a></p>
  100. </div>
  101. <div role="note" aria-label="source link">
  102. <h3>This Page</h3>
  103. <ul class="this-page-menu">
  104. <li><a href="../bugs.html">Report a Bug</a></li>
  105. <li>
  106. <a href="https://github.com/python/cpython/blob/main/Doc/library/pty.rst"
  107. rel="nofollow">Show Source
  108. </a>
  109. </li>
  110. </ul>
  111. </div>
  112. </nav>
  113. </div>
  114. </div>
  115. <div class="related" role="navigation" aria-label="related navigation">
  116. <h3>Navigation</h3>
  117. <ul>
  118. <li class="right" style="margin-right: 10px">
  119. <a href="../genindex.html" title="General Index"
  120. accesskey="I">index</a></li>
  121. <li class="right" >
  122. <a href="../py-modindex.html" title="Python Module Index"
  123. >modules</a> |</li>
  124. <li class="right" >
  125. <a href="fcntl.html" title="fcntl — The fcntl and ioctl system calls"
  126. accesskey="N">next</a> |</li>
  127. <li class="right" >
  128. <a href="tty.html" title="tty — Terminal control functions"
  129. accesskey="P">previous</a> |</li>
  130. <li><img src="../_static/py.svg" alt="Python logo" style="vertical-align: middle; margin-top: -1px"/></li>
  131. <li><a href="https://www.python.org/">Python</a> &#187;</li>
  132. <li class="switchers">
  133. <div class="language_switcher_placeholder"></div>
  134. <div class="version_switcher_placeholder"></div>
  135. </li>
  136. <li>
  137. </li>
  138. <li id="cpython-language-and-version">
  139. <a href="../index.html">3.12.3 Documentation</a> &#187;
  140. </li>
  141. <li class="nav-item nav-item-1"><a href="index.html" >The Python Standard Library</a> &#187;</li>
  142. <li class="nav-item nav-item-2"><a href="unix.html" accesskey="U">Unix Specific Services</a> &#187;</li>
  143. <li class="nav-item nav-item-this"><a href=""><code class="xref py py-mod docutils literal notranslate"><span class="pre">pty</span></code> — Pseudo-terminal utilities</a></li>
  144. <li class="right">
  145. <div class="inline-search" role="search">
  146. <form class="inline-search" action="../search.html" method="get">
  147. <input placeholder="Quick search" aria-label="Quick search" type="search" name="q" id="search-box" />
  148. <input type="submit" value="Go" />
  149. </form>
  150. </div>
  151. |
  152. </li>
  153. <li class="right">
  154. <label class="theme-selector-label">
  155. Theme
  156. <select class="theme-selector" oninput="activateTheme(this.value)">
  157. <option value="auto" selected>Auto</option>
  158. <option value="light">Light</option>
  159. <option value="dark">Dark</option>
  160. </select>
  161. </label> |</li>
  162. </ul>
  163. </div>
  164. <div class="document">
  165. <div class="documentwrapper">
  166. <div class="bodywrapper">
  167. <div class="body" role="main">
  168. <section id="module-pty">
  169. <span id="pty-pseudo-terminal-utilities"></span><h1><a class="reference internal" href="#module-pty" title="pty: Pseudo-Terminal Handling for Unix. (Unix)"><code class="xref py py-mod docutils literal notranslate"><span class="pre">pty</span></code></a> — Pseudo-terminal utilities<a class="headerlink" href="#module-pty" title="Link to this heading">¶</a></h1>
  170. <p><strong>Source code:</strong> <a class="reference external" href="https://github.com/python/cpython/tree/3.12/Lib/pty.py">Lib/pty.py</a></p>
  171. <hr class="docutils" />
  172. <p>The <a class="reference internal" href="#module-pty" title="pty: Pseudo-Terminal Handling for Unix. (Unix)"><code class="xref py py-mod docutils literal notranslate"><span class="pre">pty</span></code></a> module defines operations for handling the pseudo-terminal
  173. concept: starting another process and being able to write to and read from its
  174. controlling terminal programmatically.</p>
  175. <div class="availability docutils container">
  176. <p><a class="reference internal" href="intro.html#availability"><span class="std std-ref">Availability</span></a>: Unix.</p>
  177. </div>
  178. <p>Pseudo-terminal handling is highly platform dependent. This code is mainly
  179. tested on Linux, FreeBSD, and macOS (it is supposed to work on other POSIX
  180. platforms but it’s not been thoroughly tested).</p>
  181. <p>The <a class="reference internal" href="#module-pty" title="pty: Pseudo-Terminal Handling for Unix. (Unix)"><code class="xref py py-mod docutils literal notranslate"><span class="pre">pty</span></code></a> module defines the following functions:</p>
  182. <dl class="py function">
  183. <dt class="sig sig-object py" id="pty.fork">
  184. <span class="sig-prename descclassname"><span class="pre">pty.</span></span><span class="sig-name descname"><span class="pre">fork</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#pty.fork" title="Link to this definition">¶</a></dt>
  185. <dd><p>Fork. Connect the child’s controlling terminal to a pseudo-terminal. Return
  186. value is <code class="docutils literal notranslate"><span class="pre">(pid,</span> <span class="pre">fd)</span></code>. Note that the child gets <em>pid</em> 0, and the <em>fd</em> is
  187. <em>invalid</em>. The parent’s return value is the <em>pid</em> of the child, and <em>fd</em> is a
  188. file descriptor connected to the child’s controlling terminal (and also to the
  189. child’s standard input and output).</p>
  190. <div class="admonition warning">
  191. <p class="admonition-title">Warning</p>
  192. <p>On macOS the use of this function is unsafe when mixed with using
  193. higher-level system APIs, and that includes using <a class="reference internal" href="urllib.request.html#module-urllib.request" title="urllib.request: Extensible library for opening URLs."><code class="xref py py-mod docutils literal notranslate"><span class="pre">urllib.request</span></code></a>.</p>
  194. </div>
  195. </dd></dl>
  196. <dl class="py function">
  197. <dt class="sig sig-object py" id="pty.openpty">
  198. <span class="sig-prename descclassname"><span class="pre">pty.</span></span><span class="sig-name descname"><span class="pre">openpty</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#pty.openpty" title="Link to this definition">¶</a></dt>
  199. <dd><p>Open a new pseudo-terminal pair, using <a class="reference internal" href="os.html#os.openpty" title="os.openpty"><code class="xref py py-func docutils literal notranslate"><span class="pre">os.openpty()</span></code></a> if possible, or
  200. emulation code for generic Unix systems. Return a pair of file descriptors
  201. <code class="docutils literal notranslate"><span class="pre">(master,</span> <span class="pre">slave)</span></code>, for the master and the slave end, respectively.</p>
  202. </dd></dl>
  203. <dl class="py function">
  204. <dt class="sig sig-object py" id="pty.spawn">
  205. <span class="sig-prename descclassname"><span class="pre">pty.</span></span><span class="sig-name descname"><span class="pre">spawn</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">argv</span></span></em><span class="optional">[</span>, <em class="sig-param"><span class="n"><span class="pre">master_read</span></span></em><span class="optional">[</span>, <em class="sig-param"><span class="n"><span class="pre">stdin_read</span></span></em><span class="optional">]</span><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#pty.spawn" title="Link to this definition">¶</a></dt>
  206. <dd><p>Spawn a process, and connect its controlling terminal with the current
  207. process’s standard io. This is often used to baffle programs which insist on
  208. reading from the controlling terminal. It is expected that the process
  209. spawned behind the pty will eventually terminate, and when it does <em>spawn</em>
  210. will return.</p>
  211. <p>A loop copies STDIN of the current process to the child and data received
  212. from the child to STDOUT of the current process. It is not signaled to the
  213. child if STDIN of the current process closes down.</p>
  214. <p>The functions <em>master_read</em> and <em>stdin_read</em> are passed a file descriptor
  215. which they should read from, and they should always return a byte string. In
  216. order to force spawn to return before the child process exits an
  217. empty byte array should be returned to signal end of file.</p>
  218. <p>The default implementation for both functions will read and return up to 1024
  219. bytes each time the function is called. The <em>master_read</em> callback is passed
  220. the pseudoterminal’s master file descriptor to read output from the child
  221. process, and <em>stdin_read</em> is passed file descriptor 0, to read from the
  222. parent process’s standard input.</p>
  223. <p>Returning an empty byte string from either callback is interpreted as an
  224. end-of-file (EOF) condition, and that callback will not be called after
  225. that. If <em>stdin_read</em> signals EOF the controlling terminal can no longer
  226. communicate with the parent process OR the child process. Unless the child
  227. process will quit without any input, <em>spawn</em> will then loop forever. If
  228. <em>master_read</em> signals EOF the same behavior results (on linux at least).</p>
  229. <p>Return the exit status value from <a class="reference internal" href="os.html#os.waitpid" title="os.waitpid"><code class="xref py py-func docutils literal notranslate"><span class="pre">os.waitpid()</span></code></a> on the child process.</p>
  230. <p><a class="reference internal" href="os.html#os.waitstatus_to_exitcode" title="os.waitstatus_to_exitcode"><code class="xref py py-func docutils literal notranslate"><span class="pre">os.waitstatus_to_exitcode()</span></code></a> can be used to convert the exit status into
  231. an exit code.</p>
  232. <p class="audit-hook">Raises an <a class="reference internal" href="sys.html#auditing"><span class="std std-ref">auditing event</span></a> <code class="docutils literal notranslate"><span class="pre">pty.spawn</span></code> with argument <code class="docutils literal notranslate"><span class="pre">argv</span></code>.</p>
  233. <div class="versionchanged">
  234. <p><span class="versionmodified changed">Changed in version 3.4: </span><a class="reference internal" href="#pty.spawn" title="pty.spawn"><code class="xref py py-func docutils literal notranslate"><span class="pre">spawn()</span></code></a> now returns the status value from <a class="reference internal" href="os.html#os.waitpid" title="os.waitpid"><code class="xref py py-func docutils literal notranslate"><span class="pre">os.waitpid()</span></code></a>
  235. on the child process.</p>
  236. </div>
  237. </dd></dl>
  238. <section id="example">
  239. <h2>Example<a class="headerlink" href="#example" title="Link to this heading">¶</a></h2>
  240. <p>The following program acts like the Unix command <em class="manpage"><a class="manpage reference external" href="https://manpages.debian.org/script(1)">script(1)</a></em>, using a
  241. pseudo-terminal to record all input and output of a terminal session in a
  242. “typescript”.</p>
  243. <div class="highlight-python3 notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">argparse</span>
  244. <span class="kn">import</span> <span class="nn">os</span>
  245. <span class="kn">import</span> <span class="nn">pty</span>
  246. <span class="kn">import</span> <span class="nn">sys</span>
  247. <span class="kn">import</span> <span class="nn">time</span>
  248. <span class="n">parser</span> <span class="o">=</span> <span class="n">argparse</span><span class="o">.</span><span class="n">ArgumentParser</span><span class="p">()</span>
  249. <span class="n">parser</span><span class="o">.</span><span class="n">add_argument</span><span class="p">(</span><span class="s1">&#39;-a&#39;</span><span class="p">,</span> <span class="n">dest</span><span class="o">=</span><span class="s1">&#39;append&#39;</span><span class="p">,</span> <span class="n">action</span><span class="o">=</span><span class="s1">&#39;store_true&#39;</span><span class="p">)</span>
  250. <span class="n">parser</span><span class="o">.</span><span class="n">add_argument</span><span class="p">(</span><span class="s1">&#39;-p&#39;</span><span class="p">,</span> <span class="n">dest</span><span class="o">=</span><span class="s1">&#39;use_python&#39;</span><span class="p">,</span> <span class="n">action</span><span class="o">=</span><span class="s1">&#39;store_true&#39;</span><span class="p">)</span>
  251. <span class="n">parser</span><span class="o">.</span><span class="n">add_argument</span><span class="p">(</span><span class="s1">&#39;filename&#39;</span><span class="p">,</span> <span class="n">nargs</span><span class="o">=</span><span class="s1">&#39;?&#39;</span><span class="p">,</span> <span class="n">default</span><span class="o">=</span><span class="s1">&#39;typescript&#39;</span><span class="p">)</span>
  252. <span class="n">options</span> <span class="o">=</span> <span class="n">parser</span><span class="o">.</span><span class="n">parse_args</span><span class="p">()</span>
  253. <span class="n">shell</span> <span class="o">=</span> <span class="n">sys</span><span class="o">.</span><span class="n">executable</span> <span class="k">if</span> <span class="n">options</span><span class="o">.</span><span class="n">use_python</span> <span class="k">else</span> <span class="n">os</span><span class="o">.</span><span class="n">environ</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s1">&#39;SHELL&#39;</span><span class="p">,</span> <span class="s1">&#39;sh&#39;</span><span class="p">)</span>
  254. <span class="n">filename</span> <span class="o">=</span> <span class="n">options</span><span class="o">.</span><span class="n">filename</span>
  255. <span class="n">mode</span> <span class="o">=</span> <span class="s1">&#39;ab&#39;</span> <span class="k">if</span> <span class="n">options</span><span class="o">.</span><span class="n">append</span> <span class="k">else</span> <span class="s1">&#39;wb&#39;</span>
  256. <span class="k">with</span> <span class="nb">open</span><span class="p">(</span><span class="n">filename</span><span class="p">,</span> <span class="n">mode</span><span class="p">)</span> <span class="k">as</span> <span class="n">script</span><span class="p">:</span>
  257. <span class="k">def</span> <span class="nf">read</span><span class="p">(</span><span class="n">fd</span><span class="p">):</span>
  258. <span class="n">data</span> <span class="o">=</span> <span class="n">os</span><span class="o">.</span><span class="n">read</span><span class="p">(</span><span class="n">fd</span><span class="p">,</span> <span class="mi">1024</span><span class="p">)</span>
  259. <span class="n">script</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="n">data</span><span class="p">)</span>
  260. <span class="k">return</span> <span class="n">data</span>
  261. <span class="nb">print</span><span class="p">(</span><span class="s1">&#39;Script started, file is&#39;</span><span class="p">,</span> <span class="n">filename</span><span class="p">)</span>
  262. <span class="n">script</span><span class="o">.</span><span class="n">write</span><span class="p">((</span><span class="s1">&#39;Script started on </span><span class="si">%s</span><span class="se">\n</span><span class="s1">&#39;</span> <span class="o">%</span> <span class="n">time</span><span class="o">.</span><span class="n">asctime</span><span class="p">())</span><span class="o">.</span><span class="n">encode</span><span class="p">())</span>
  263. <span class="n">pty</span><span class="o">.</span><span class="n">spawn</span><span class="p">(</span><span class="n">shell</span><span class="p">,</span> <span class="n">read</span><span class="p">)</span>
  264. <span class="n">script</span><span class="o">.</span><span class="n">write</span><span class="p">((</span><span class="s1">&#39;Script done on </span><span class="si">%s</span><span class="se">\n</span><span class="s1">&#39;</span> <span class="o">%</span> <span class="n">time</span><span class="o">.</span><span class="n">asctime</span><span class="p">())</span><span class="o">.</span><span class="n">encode</span><span class="p">())</span>
  265. <span class="nb">print</span><span class="p">(</span><span class="s1">&#39;Script done, file is&#39;</span><span class="p">,</span> <span class="n">filename</span><span class="p">)</span>
  266. </pre></div>
  267. </div>
  268. </section>
  269. </section>
  270. <div class="clearer"></div>
  271. </div>
  272. </div>
  273. </div>
  274. <div class="sphinxsidebar" role="navigation" aria-label="main navigation">
  275. <div class="sphinxsidebarwrapper">
  276. <div>
  277. <h3><a href="../contents.html">Table of Contents</a></h3>
  278. <ul>
  279. <li><a class="reference internal" href="#"><code class="xref py py-mod docutils literal notranslate"><span class="pre">pty</span></code> — Pseudo-terminal utilities</a><ul>
  280. <li><a class="reference internal" href="#example">Example</a></li>
  281. </ul>
  282. </li>
  283. </ul>
  284. </div>
  285. <div>
  286. <h4>Previous topic</h4>
  287. <p class="topless"><a href="tty.html"
  288. title="previous chapter"><code class="xref py py-mod docutils literal notranslate"><span class="pre">tty</span></code> — Terminal control functions</a></p>
  289. </div>
  290. <div>
  291. <h4>Next topic</h4>
  292. <p class="topless"><a href="fcntl.html"
  293. title="next chapter"><code class="xref py py-mod docutils literal notranslate"><span class="pre">fcntl</span></code> — The <code class="docutils literal notranslate"><span class="pre">fcntl</span></code> and <code class="docutils literal notranslate"><span class="pre">ioctl</span></code> system calls</a></p>
  294. </div>
  295. <div role="note" aria-label="source link">
  296. <h3>This Page</h3>
  297. <ul class="this-page-menu">
  298. <li><a href="../bugs.html">Report a Bug</a></li>
  299. <li>
  300. <a href="https://github.com/python/cpython/blob/main/Doc/library/pty.rst"
  301. rel="nofollow">Show Source
  302. </a>
  303. </li>
  304. </ul>
  305. </div>
  306. </div>
  307. <div id="sidebarbutton" title="Collapse sidebar">
  308. <span>«</span>
  309. </div>
  310. </div>
  311. <div class="clearer"></div>
  312. </div>
  313. <div class="related" role="navigation" aria-label="related navigation">
  314. <h3>Navigation</h3>
  315. <ul>
  316. <li class="right" style="margin-right: 10px">
  317. <a href="../genindex.html" title="General Index"
  318. >index</a></li>
  319. <li class="right" >
  320. <a href="../py-modindex.html" title="Python Module Index"
  321. >modules</a> |</li>
  322. <li class="right" >
  323. <a href="fcntl.html" title="fcntl — The fcntl and ioctl system calls"
  324. >next</a> |</li>
  325. <li class="right" >
  326. <a href="tty.html" title="tty — Terminal control functions"
  327. >previous</a> |</li>
  328. <li><img src="../_static/py.svg" alt="Python logo" style="vertical-align: middle; margin-top: -1px"/></li>
  329. <li><a href="https://www.python.org/">Python</a> &#187;</li>
  330. <li class="switchers">
  331. <div class="language_switcher_placeholder"></div>
  332. <div class="version_switcher_placeholder"></div>
  333. </li>
  334. <li>
  335. </li>
  336. <li id="cpython-language-and-version">
  337. <a href="../index.html">3.12.3 Documentation</a> &#187;
  338. </li>
  339. <li class="nav-item nav-item-1"><a href="index.html" >The Python Standard Library</a> &#187;</li>
  340. <li class="nav-item nav-item-2"><a href="unix.html" >Unix Specific Services</a> &#187;</li>
  341. <li class="nav-item nav-item-this"><a href=""><code class="xref py py-mod docutils literal notranslate"><span class="pre">pty</span></code> — Pseudo-terminal utilities</a></li>
  342. <li class="right">
  343. <div class="inline-search" role="search">
  344. <form class="inline-search" action="../search.html" method="get">
  345. <input placeholder="Quick search" aria-label="Quick search" type="search" name="q" id="search-box" />
  346. <input type="submit" value="Go" />
  347. </form>
  348. </div>
  349. |
  350. </li>
  351. <li class="right">
  352. <label class="theme-selector-label">
  353. Theme
  354. <select class="theme-selector" oninput="activateTheme(this.value)">
  355. <option value="auto" selected>Auto</option>
  356. <option value="light">Light</option>
  357. <option value="dark">Dark</option>
  358. </select>
  359. </label> |</li>
  360. </ul>
  361. </div>
  362. <div class="footer">
  363. &copy;
  364. <a href="../copyright.html">
  365. Copyright
  366. </a>
  367. 2001-2024, Python Software Foundation.
  368. <br />
  369. This page is licensed under the Python Software Foundation License Version 2.
  370. <br />
  371. Examples, recipes, and other code in the documentation are additionally licensed under the Zero Clause BSD License.
  372. <br />
  373. See <a href="/license.html">History and License</a> for more information.<br />
  374. <br />
  375. The Python Software Foundation is a non-profit corporation.
  376. <a href="https://www.python.org/psf/donations/">Please donate.</a>
  377. <br />
  378. <br />
  379. Last updated on Apr 09, 2024 (13:47 UTC).
  380. <a href="/bugs.html">Found a bug</a>?
  381. <br />
  382. Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 7.2.6.
  383. </div>
  384. </body>
  385. </html>
上海开阖软件有限公司 沪ICP备12045867号-1