all Python 3until 3.13Removed from the standard libraryterm
pipes
removed modules
Shell command pipelines and argument quoting. Removed in Python 3.13 — use subprocess and shlex.quote.
Syntax
import pipes # до 3.13
pipes.Template built a pipeline like 'tr a-z A-Z | sort' and ran a file through it, while the undocumented pipes.quote() quoted an argument for the shell — that is what old answers copied most often. PEP 594 dropped it: subprocess does the same more reliably. How to port: pipes.quote becomes shlex.quote one to one, and shlex.join() builds a command string from a list. Better not to hand the pipeline to a shell at all: subprocess.run([...], input=..., capture_output=True, text=True) runs a program without a shell and feeds data via stdin, and a chain of programs is several subprocess.Popen calls linked with stdout=PIPE. The standard-pipes package on PyPI restores the module.
Examples
# Python 3.13+
try:
import pipes
except ModuleNotFoundError as e:
print(type(e).__name__) # → ModuleNotFoundError
# Python 3.13+
import shlex, subprocess, sys
print(shlex.quote('my file.txt')) # → 'my file.txt'
done = subprocess.run([sys.executable, '-c', 'print(input().upper())'],
input='hi', capture_output=True, text=True)
print(done.stdout.strip()) # → HI
import pipes
print(pipes.quote('my file.txt')) # → 'my file.txt'
See also
Common errors
Open in the full glossarydocs.python.orgReport an inaccuracy