About 237,000 results
Open links in new tab
  1. How do I create a subprocess in Python? - Stack Overflow

    Oct 17, 2018 · what subprocess.call does? i am running a file named test.py and i want to run it creating subprocess. did it means that i have to run it like subprocess.call(['python', 'test.py']) ? – sasa Commented Dec 20, 2010 at 9:21

  2. Python subprocess - run multiple shell commands over SSH

    basically if you call subprocess it creates a local subprocess not a remote one so you should interact with the ssh process. so something along this lines: but be aware that if you dynamically construct my directory it is suceptible of shell injection then END line should be a unique identifier To avoid the uniqueness of END line problem, an easiest way would be to use different ssh …

  3. python - How do I execute a program or call a system command?

    Use the subprocess module (Python 3): import subprocess subprocess.run(['ls', '-l']) It is the recommended standard way. However, more complicated tasks (pipes, output, input, etc.) can be tedious to construct and write. Note on Python version: If you are still using Python 2, subprocess.call works in a similar way.

  4. python - Retrieving the output of subprocess.call () - Stack Overflow

    The simple answer for Python 2.7 would be subprocess.check_output(); in Python 3.5+ you will also want to look at subprocess.run(). There should be no need or want to use raw subprocess.Popen() if you can avoid it, though some more complex use cases require it (and then you have to do the required plumbing around it yourself).

  5. Making sure a Python script with subprocesses dies on SIGINT

    I've got a command that I'm wrapping in script and spawning from a Python script using subprocess.Popen. I'm trying to make sure it dies if the user issues a SIGINT. I could figure out if the process was interrupted in a least two ways: A. Die if the wrapped command has a non-zero exit status (doesn't work, because script seems to always return ...

  6. Using subprocess to run Python script on Windows

    Why use subprocess to run a python script? Is there something preventing you from importing the script and calling the necessary function? I was writing a quick script to test the overall functionality of a Python-command-line tool (to test it on various platforms).

  7. Windows can't find the file on subprocess.call () - Stack Overflow

    "Prior to Python 3.5, these three functions comprised the high level API to subprocess. You can now use run() in many cases, but lots of existing code calls these functions." SO: instead of subprocess.call use subprocess.run for Python 3.5 and above

  8. python - Run subprocess and print output to logging - Stack …

    You could try to pass the pipe directly without buffering the whole subprocess output in memory: from subprocess import Popen, PIPE, STDOUT process = Popen(command_line_args, stdout=PIPE, stderr=STDOUT) with process.stdout: log_subprocess_output(process.stdout) exitcode = process.wait() # 0 means success

  9. python - Using module 'subprocess' with timeout - Stack Overflow

    Jul 28, 2009 · Here's the Python code to run an arbitrary command returning its stdout data, or raise an exception on non-zero exit codes: proc = subprocess.Popen( cmd, stderr=subprocess.STDOUT, # Merge

  10. Python threading multiple bash subprocesses? - Stack Overflow

    Jan 26, 2013 · Dear Sebastian, I'm trying to do something similar, namely: run first a subprocess p, once p running, I then call a second subprocess p2, I attempt to run p2 in a new terminal window, but I can't make it work with subprocess.CREATE_NEW_CONSOLE as that seems to be only for windows machines.

Refresh