On this page
pty.openpty
Prev: pty.fork | Up: pty | Next: pty.spawn
Rel: pty.fork, pty.spawn
Ref: docs.python.org — pty.openpty
Tags: #public #python3 #stdlib #pty
Import
import pty
from pty import openpty
Signature & Overview
pty.openpty()
Open a pty master/slave pair, using os.openpty() if possible.
Usage
import os
import pty
master, slave = pty.openpty()
try:
assert master >= 0 and slave >= 0
finally:
os.close(master); os.close(slave)
Gotchas
- Unix-only: Great for passing
slaveasstdin/stdouttosubprocess.Popento force line-buffered TTY output.
REPL Inspect
from pty import openpty
help(openpty)
Linked from
Related notes
- tuts/python3/stdlib_module/pty/fork Linked here; links to this page; shared tags: #pty, #stdlib
- tuts/python3/stdlib_module/pty/spawn Linked here; links to this page; shared tags: #pty, #stdlib
- tuts/python3/stdlib_module/pty Linked here; links to this page; shared tags: #stdlib
- tuts/c/stdlib shared tags: #stdlib
- tuts/c/stdlib/assert shared tags: #stdlib
- tuts/c/stdlib/assert/assert shared tags: #stdlib
- tuts/c/stdlib/assert/static_assert shared tags: #stdlib
- tuts/c/stdlib/ctype shared tags: #stdlib
- tuts/c/stdlib/ctype/isalpha shared tags: #stdlib
- tuts/c/stdlib/ctype/isdigit shared tags: #stdlib