title: Executing a subprocess fails
body: <p>I tried to call a process via Python with several arguments. Executing the batch file itself works fine for me but translating it into Python makes me scream. Here the contents of the batch file:</p>
  
  <pre><code>"C:\Program Files\bin\cspybat" "C:\Program Files\bin\armproc.dll" "C:\Program Files\bin\armjlink.dll" "C:\Documents and Settings\USER\Desktop\CAL\testing\Verification\FRT\Code\TC1\Output\Genericb\Debug\Exe\Gen.out" --download_only --backend -B "--endian=little" "--cpu=Cortex-M3" "--fpu=None" "-p" "C:\Program Files\CONFIG\debugger\ST\iostm32f10xxb.ddf" "--drv_verify_download" "--semihosting" "--device=STM32F10xxB" "-d" "jlink" "--drv_communication=USB0" "--jlink_speed=auto" "--jlink_initial_speed=32" "--jlink_reset_strategy=0,0" 
  </code></pre>
  
  <p>The executable that is run by the batch file is named <code>cspybat</code>. The output of the executable provides the information: <code>All parameters after</code>--backend<code>are passed to the back end</code>.</p>
  
  <p>Also note that some of the the parameters are strings and some not.</p>
  
  <p><em>Solution</em></p>
  
  <p>That works for me now:</p>
  
  <pre><code>    """ MCU flashing function""" 
  params = [r"C:\Program Files\bin\cspy",
            r"C:\Program Files\bin\arpro.dll",
            r"C:\Program Files\bin\arjink.dll",
            r"C:\Documents and Settings\USER\Desktop\Exe\GenerV530b.out",
            "--download_only", "--backend", "-B", "--endian=little", "--cpu=Cort3", "--fpu=None", "-p", 
            r"C:\Program Files\CONFIG\debugger\ST\iostm32f10xxb.ddf",
             "--drv_verify_download", "--semihosting", "--device=STM32F10xxB", "-d", "jlink", "--drv_communication=USB0",
              "--jlink_speed=auto", "--jlink_initial_speed=32", "--jlink_reset_strategy=0,0" ]
  print(subprocess.list2cmdline(params))
  p = subprocess.Popen(subprocess.list2cmdline(params))
  </code></pre>