subprocess.popen no output 1

subprocess.popen no output

pipe = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)

Here is what the above code is Doing:
1. We’re creating a variable called cmd that contains the command we want to run.
2. We’re creating a variable called pipe that contains the output of the command we want to run.
3. We’re using the subprocess module to run the command.
4. We’re using the shell=True argument to tell Python to run the command as a shell command.
5. We’re using the stdout=subprocess.PIPE argument to tell Python to pipe the output of the command to a variable.
6. We’re using the stderr=subprocess.PIPE argument to tell Python to pipe any errors to a variable.

Similar Posts