title: How to run Google gsutil using Python
body: <p>After installing and configuring Google Cloud SDK <code>gsutil</code> command can be run by simply typing its name and the argument(-s) using Windows cmd.</p>
  
  <p>Here is the example:</p>
  
  <p><code>"C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\bin\gcloud" version</code></p>
  
  <p><a href="https://i.stack.imgur.com/rheCS.png" rel="noreferrer"><img src="https://i.stack.imgur.com/rheCS.png" alt="enter image description here"></a></p>
  
  <p>But the same command fails if run using Python subprocess. 
  With subprocess's <code>shell</code> argument set to True the <code>ImportError</code> occurs:</p>
  
  <pre><code>import subprocess
  
  cmd = '"C:/Program Files (x86)/Google/Cloud SDK/google-cloud-sdk/bin/gsutil" version'
  
  p = subprocess.Popen(cmd, shell=True)
  </code></pre>
  
  <p>.....</p>
  
  <pre><code>ImportError: No module named site
  </code></pre>
  
  <p>With subprocess's <code>shell</code> argument set to False then the <code>WindowsError: [Error 2] The system cannot find the file specified</code> occurs:</p>
  
  <pre><code>p = subprocess.Popen(cmd, shell=False)
  </code></pre>
  
  <p>Is there a way to run <code>gsutil</code> on Windows using Python?</p>