linux - Python subprocess passes one argument only -


I have a Python script (2.7) which I use to apply an external process. Recently it worked fine.

But now when I run it, I feel that it does not exceed the logic of the process. I have also debug the implementation process and it only receives the path of a logic (process executable).

  p = subprocess.Popen ([". / Myapp", "-p", "s"], shell = true) p.communicate ()  

The code passes only "myapp" as a command argument. Why can this happen?

when open = true , just a string (no list) pass Do;

  p = subprocess.Popen ('./ myapp -ps', shell = true) p. As always  
  • shell = wrong

update

( Default) to shell = true and pass an array of stars; And

  • A complete path to the executable, not a relative path.
  • Ie;

      Subprocess. If you are interested only in the form of [[Proc: stdout, stderr = proc.communicate ()  

    popen (code)> standout (And not stderr ), like the above solution (it is safe and small):

      stdout = subprocess.check_output ['/ path / from / binaries ',' -P ',' S '])  

    Comments

    Popular posts from this blog

    java - org.apache.http.ProtocolException: Target host is not specified -

    java - Gradle dependencies: compile project by relative path -

    ruby on rails - Object doesn't support #inspect when used with .include -