1

I ran this in Python 3.5:

import subprocess
subprocess.run(
    'some_command --option <(zcat some_file_1.gz) <(zcat some_file_2.gz)', 
    shell=True
)

Got this error:

/bin/sh: -c: line 0: syntax error near unexpected token `('

Any help will be greatly appreciated!

2 Answers2

4

Process substitution using <(...) is not defined in POSIX. you should use something like bash. You can pass executable="/bin/bash" to run the command using bash.

subprocess.run('cat <(echo hoo)', shell=True, executable="/bin/bash")
ymonad
  • 11,040
  • 1
  • 36
  • 47
2

The default shell being invoked is /bin/sh and it does not support process substitution (the <(...) syntax), which is a Bash feature.

Arkady
  • 13,115
  • 7
  • 38
  • 46