python Popen shell=True behavior
<p>Why would this doesn't work: <code>subprocess.Popen(["ls -l | grep myfile"], shell=False)</code>
But this line works: <code>subprocess.Popen(["ls -l | grep myfile"], shell=True)</code>
I understand this shell=True create a sub shell internally and execute command. But didn't understand how this affect Popen behavior</p>

<p><code>shell=True</code> is used to pass a single <em>string</em> as a command line to a shell. While it's technically possible to pass a list, it's probably never what you want.</p>

<pre><code>subprocess.Popen("ls -l | grep myfile", shell=True)
</code></pre>

python python-3.x subprocess