Running an AWS cli command from a local python script?
<p>I'm trying to run this aws s3 ls command:</p>

<pre><code>aws s3 ls s3://path/to/my/bucket/12434 --recursive --human-readable --summarize
</code></pre>

<p>with this python:</p>

<pre><code>command = 'aws s3 ls s3://path/to/my/bucket/12434 --recursive --human-readable --summarize'
s3_folder_data  = subprocess.check_output(command, stderr=subprocess.STDOUT, shell=True)
print s3_folder_data
</code></pre>

<p>But it's failing with this error:</p>

<pre><code>subprocess.CalledProcessError: Command 'aws s3 ls s3://path/to/my/bucket/12434 --recursive --human-readable --summarize' returned non-zero exit status 1
</code></pre>

<p>The command itself works when I run it. The python script is being called by the same user on the same machine. What gives?</p>