Is there a way to do multiple calls in the same ‘session’ in Popen? For instance, can I make a call through it and then another one after it without having to concatenate the commands into one long string?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You’re not ‘making a call’ when you use popen, you’re running an executable and talking to it over stdin, stdout, and stderr. If the executable has some way of doing a ‘session’ of work (for instance, by reading lines from stdin) then, yes, you can do it. Otherwise, you’ll need to exec multiple times.
subprocess.Popen is (mostly) just a wrapper around execvp(3)