title: How to call from within Python an application with double quotes around an argument using subprocess?
body: <p>I'm trying to call <strong>certutil</strong> from inside <strong>python</strong>. However I need to use quotation marks and have been unable to do so. My code is as follows:</p>
  
  <pre><code>import subprocess
  output= subprocess.Popen(("certutil.exe", "-view", '-restrict "NotAfter &lt;= now+30:00, NotAfter &gt;= now+00:00"' ), stdout=subprocess.PIPE).stdout
  for line in output:
      print(line)
  
  output.close()
  </code></pre>
  
  <p>I thought the single quotes would allow me to use double quotes inside the string.</p>
  
  <p>Also I have tried using double quotes with the escape character (<code>\"</code>), however I keep getting the same error:</p>
  
  <pre><code>Unknown arg: -restrict \\NotAfter\r\n'
  </code></pre>
  
  <p>For some reason it seems to be translating <code>"</code> into <code>\\</code>.</p>
  
  <p>Can anyone give insight as to why and how to fix it?</p>