Skip to content

Magenaut

  • Home
  • Topics
    • Notes
    • Tutorial
    • Bug fixing
    • Extension
    • Server
  • Q&A
  • Privacy Policy
  • About

subprocess

How to kill a python child process created with subprocess.check_output() when the parent dies?

August 16, 2022 by Magenaut

I am running on a linux machine a python script which creates a child process using subprocess.check_output() as it follows:

Categories Python, Q&A Tags linux, python, subprocess Leave a comment

What’s a good equivalent to subprocess.check_call that returns the contents of stdout?

August 15, 2022 by Magenaut

I’d like a good method that matches the interface of subprocess.check_call — ie, it throws CalledProcessError when it fails, is synchronous, &c — but instead of returning the return code of the command (if it even does that) returns the program’s output, either only stdout, or a tuple of (stdout, stderr).

Categories Python, Q&A Tags python, subprocess Leave a comment

subprocess “TypeError: a bytes-like object is required, not ‘str'”

August 15, 2022 by Magenaut

I’m using this code from a previously asked question a few years ago, however, I believe this is outdated. Trying to run the code, I receive the error above. I’m still a novice in Python, so I could not get much clarification from similar questions. Does anyone know why this is happening?

Categories Python, Q&A Tags python, string, subprocess Leave a comment

running multiple bash commands with subprocess

August 15, 2022 by Magenaut

If I run echo a; echo b in bash the result will be that both commands are run. However if I use subprocess then the first command is run, printing out the whole of the rest of the line.
The code below echos a; echo b instead of a b, how do I get it to run both commands?

Categories Python, Q&A Tags bash, python, subprocess Leave a comment

running a command as a super user from a python script

August 15, 2022 by Magenaut

So I’m trying to get a process to be run as a super user from within a python script using subprocess. In the ipython shell something like

Categories Python, Q&A Tags python, subprocess, sudo Leave a comment

Passing double quote shell commands in python to subprocess.Popen()?

August 15, 2022 by Magenaut

I’ve been trying to pass a command that works only with literal double quotes in the commandline around the "concat:file1|file2" argument for ffmpeg.

Categories Python, Q&A Tags python, subprocess Leave a comment

What’s the difference between subprocess Popen and call (how can I use them)?

August 15, 2022 by Magenaut

I want to call an external program from Python. I have used both Popen() and call() to do that.

Categories Python, Q&A Tags popen, python, subprocess Leave a comment

Display realtime output of a subprocess in a tkinter widget

August 15, 2022 by Magenaut

My question is almost the same as this one:
Widget to Display subprocess stdout?
but a step further.

Categories Python, Q&A Tags python, python-2.7, subprocess, tkinter Leave a comment

How to suppress or capture the output of subprocess.run()?

August 15, 2022 by Magenaut

From the examples in docs on subprocess.run() it seems like there shouldn’t be any output from

Categories Python, Q&A Tags python, python-3.x, subprocess Leave a comment

Cross-platform subprocess with hidden window

August 15, 2022 by Magenaut

I want to open a process in the background and interact with it, but this process should be invisible in both Linux and Windows. In Windows you have to do some stuff with STARTUPINFO, while this isn’t valid in Linux:

Categories Python, Q&A Tags cross-platform, linux, python, subprocess, windows Leave a comment
Older posts
Newer posts
← Previous Page1 … Page6 Page7 Page8 … Page10 Next →
  1. michealSmith07 on Is there a way to dynamically refresh the less command?August 21, 2022

    That is a very nice post. I like this post.

  2. anonymous on Fix libwacom9 dependency issue when upgrade DebianJune 27, 2022

    saved my day!! Thanks for the help…

  3. sreedhar on Fix libwacom9 dependency issue when upgrade DebianMay 10, 2022

    Thanks its working

  4. saintnick on Fix libwacom9 dependency issue when upgrade DebianMay 10, 2022

    remove libwacom2 worked for me as well

  5. ranafoul on Fix libwacom9 dependency issue when upgrade DebianApril 22, 2022

    apt remove libwacom2 helped on kali 2022.01. gr8

.net ajax asp.net asp.net-core asp.net-mvc asp.net-mvc-3 asp.net-mvc-4 asp.net-web-api bash c# command-line css custom-post-types custom-taxonomy dataframe dictionary django entity-framework functions gridview html iis javascript jquery json linux list matplotlib numpy pandas php plugin-development plugins posts python python-2.7 python-3.x security shell shell-script sql string vb.net webforms wp-query

© 2026 Magenaut • Built with GeneratePress