On a unix command line I can do:
paste <(echo A) <(echo B)
However, when I try to do this:
import subprocess
subprocess.call('paste <(echo A) <(echo B)', shell = True)
I get this error:
/bin/sh: -c: line 0: syntax error near unexpected token `('
/bin/sh: -c: line 0: `paste <(echo A) <(echo B)'
Is it not possible to do shell input redirection with the subprocess module?
Many things by default use /bin/sh
as the shell of choice. /bin/sh
is often not bash.
The /bin/sh
on your system most likely does not support process substitution.
Convince subprocess.call
to use /bin/bash
as the shell instead and it should work.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.