Process substitution not allowed by Python's subprocess with shell=True?
<p>Here is a toy example of process substitution that works fine in Bash:</p>

<pre><code>$ wc -l &lt;(pwd)
1 /proc/self/fd/11
</code></pre>

<p>So why does the same command give a syntax error when invoked from Python's subprocess with shell=True?  </p>

<pre><code>&gt;&gt;&gt; subprocess.check_call('wc -l &lt;(pwd)', shell=True)
/bin/sh: 1: Syntax error: "(" unexpected
Traceback (most recent call last):
  File "&lt;stdin&gt;", line 1, in &lt;module&gt;
  File "/path/to/my/python/lib/python3.5/subprocess.py", line 581, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command 'wc -l &lt;(pwd)' returned non-zero exit status 2
</code></pre>

<blockquote>
  <p>/bin/sh: 1: Syntax error: "(" unexpected</p>
</blockquote>

<p>You have a <a href="https://en.wiktionary.org/wiki/bashism" rel="nofollow">bashism</a>.  It is not valid according to POSIX, which is what <code>/bin/sh</code> implements.</p>

python bash shell subprocess process-substitution