Popen shell commands and problems with spaces
<p>I have this code, it runs whatever command the user enters for adb, e,g the user enters the word 'devices' and 'adb.exe devices' will run and print out the device list.
This works fine with 'devices' but whenever a more complex command is issued, such as one with spaces, 'shell pm path com.myapp.app' it fails.</p>

<pre><code>       c_arg = self.cmdTxt.GetValue() ##gets the user input, a string
       params = [toolsDir + '\\adb.exe', c_arg] ##builds the command
       p = Popen(params, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)  ## executes the command
       stdout, stderr = p.communicate()  ## get output
       self.progressBox.AppendText(stdout) # print output of command
</code></pre>

<p>Is there some formatting or processing I need to do on the string from .GetValue() before I can put it into params and run it in Popen?</p>

<p><code>subprocess.Popen</code> with <em>shell=True</em> takes the full command string, not a list.</p>

<pre><code>params = str(buildpath)+"\\adb.exe"+c_arg #c_arg is a string of arguments.
</code></pre>

android python shell wx