title: Structuring python code to run a message through subprocess.Popen
body: <p>I am in a process of building a simple remote shell tool to communicate with Windows 10. Server sends a "message" through its own shell to the client who runs the message. I need this received message to be run by other process other that default cmd (shell=True) - a specified app.exe.  Here is the code that runs on the client:
  1)</p>
  
  <pre><code>def work( storage, message ) :
      import subprocess   
      process = subprocess.Popen([message], stdout=subprocess.PIPE, stderr=None, shell=True)
  
      #Launch the shell command:
      output = process.communicate()
  
      print output[0]
  </code></pre>
  
  <p>I tried including "app.exe" or "cmd"  to execute the message but with that I get error: TypeError: bufsize must be an integer. </p>
  
  <p>I have also tried pinpointing the issue locally and I can run:
  2)</p>
  
  <pre><code>import subprocess
  import sys
  subprocess.Popen(["C:\\Users\\User\\Desktop\\app.exe", "-switch"] + sys.argv[1:], shell=False)
  </code></pre>
  
  <p>and pass arguments from a command terminal and it works as it should. Now I am trying to apply the same logic to a remote execution with my program and use either solution 1 or 2.</p>
  
  <p>Update:
  3) Trying to implement what I did locally to a remote solution: </p>
  
  <pre><code>def work( storage, message ) :
      import subprocess
      import sys
  
      process = subprocess.Popen(["C:\\Users\\User\\Desktop\\app.exe", "-switch"] + sys.argv[1:], shell=False)
  
      #Launch the shell command:
      output = process.communicate()
  
      print output[0]
  </code></pre>
  
  <p>I tried replacing sys.argv[1:] with message but I get:
  TypeError: can only concatenate list (not "str") to list</p>