title: How to supply multi line command to subprocess.Popen?
body: <p>I need to be able to run a multi line dtrace script via python subprocess.Popen, and tried this... have the following code snippet in python but this does not work, what is the correct approach for handling such templates?</p>
  
  <pre><code>    cmd = "/usr/sbin/dtrace -n '
      #pragma D option quiet
      profile:::profile-1001hz
      /arg0/
      {
              \@pc[arg0] = count();
      }
      dtrace:::END
      {
              printa("%a %\@d\\n", \@pc);
      }'"
  
      def execute_hotkernel():
      proc = subprocess.Popen(cmd, stdout = subprocess.PIPE, stderr = subprocess.PIPE)
      (output, error) = proc.communicate()
      print output
  </code></pre>
  
  <p>Using the quotes does not help enclose the multi line command into <code>cmd</code>. Get the following error when attempted to run <code>SyntaxError: EOL while scanning string literal</code></p>