Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/pexpect/ptyprocess
Run a subprocess in a pseudo terminal
https://github.com/pexpect/ptyprocess
Last synced: about 2 months ago
JSON representation
Run a subprocess in a pseudo terminal
- Host: GitHub
- URL: https://github.com/pexpect/ptyprocess
- Owner: pexpect
- License: other
- Created: 2014-10-02T16:52:41.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2023-10-24T15:09:01.000Z (about 1 year ago)
- Last Synced: 2024-10-29T15:54:15.370Z (about 2 months ago)
- Language: Python
- Homepage: https://ptyprocess.readthedocs.io/en/latest/
- Size: 189 KB
- Stars: 220
- Watchers: 19
- Forks: 71
- Open Issues: 21
-
Metadata Files:
- Readme: README.rst
- License: LICENSE
Awesome Lists containing this project
- best-of-python - GitHub - 51% open · ⏱️ 23.10.2023): (Process Utilities)
README
Launch a subprocess in a pseudo terminal (pty), and interact with both the
process and its pty.Sometimes, piping stdin and stdout is not enough. There might be a password
prompt that doesn't read from stdin, output that changes when it's going to a
pipe rather than a terminal, or curses-style interfaces that rely on a terminal.
If you need to automate these things, running the process in a pseudo terminal
(pty) is the answer.Interface:
.. code:: python
from ptyprocess import PtyProcessUnicode
p = PtyProcessUnicode.spawn(['python'])
p.read(20)
p.write('6+6\n')
p.read(20)