all Python 3osfunction
os.pipe
os — file descriptors
Create a pipe: return a (read_fd, write_fd) pair.
Syntax
os.pipe()
Reading a pipe blocks until someone writes, and writing blocks while the buffer is full (about 64 KiB on Linux). Writing to and reading from a pipe in one thread is a classic deadlock. The reader sees end of data only after every copy of the write end is closed, including those inherited by a child. Since 3.4 the descriptors are non-inheritable by default.
Examples
import os
r, w = os.pipe()
print(isinstance(r, int) and isinstance(w, int)) # → True
os.close(r)
os.close(w)
See also
Open in the full glossarydocs.python.orgReport an inaccuracy