Python 3.3+ has it as shelex.quote while Python 2 has it as pipes.quote. As the pipes module is deprecated since Python 3.11, this raises a deprecation warning:
DeprecationWarning: 'pipes' is deprecated and slated for removal in Python 3.13
from pipes import quote
We can easily avoid that by first trying shlex.quote and falling back to pipes.quote only for Python 2 where shlex.quote doesn't exist.
Python 3.3+ has it as
shelex.quote
while Python 2 has it aspipes.quote
. As thepipes
module is deprecated since Python 3.11, this raises a deprecation warning:We can easily avoid that by first trying
shlex.quote
and falling back topipes.quote
only for Python 2 whereshlex.quote
doesn't exist.