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!

  • process substitution using `<(...)` is not defined in POSIX. you should use something like bash. – ymonad Oct 17 '17 at 01:27

2 Answers2

5

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,710
  • 1
  • 38
  • 49
2

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

Arkady
  • 14,305
  • 8
  • 42
  • 46