Questions tagged [subprocess]
The Python subprocess module allows you to spawn new processes, connect to their input/output/error pipes, and obtain their return codes. Use it to run a shell command or an executable in Python.
subprocess
12,347
questions
-2
votes
0
answers
18
views
Organization of processes [closed]
I am new to Python development.
My project has two Python scripts. One is responsible for processing requests from the user.
The second is responsible for executing a scheduled task.
Both run on a ...
0
votes
0
answers
43
views
Why does process.communicate cause my program to be killed?
I'm running some code for a program in python, and when I run c++ I need to handle standard input for my it, such as scanf and cin. I am running the compiled c++ program using subprocess.Popen. I ...
0
votes
0
answers
8
views
How can I install html5lib on a dataproc cluster
I have a dataproc pipeline with which I do webscraping and store data in gcp.
Task setting is something like this:
create_dataproc_cluster = DataprocCreateClusterOperator(
task_id='...
-1
votes
1
answer
26
views
Calling `subprocess` in Python notebook has different `$PATH` than `!` shell
I am developing a wrapper class interactively in an IPython notebook. This wrapper class invokes a command line program written in java, and thus I need access to the same version of the java runtime ...
-3
votes
1
answer
53
views
Python calling another file [closed]
I need help calling a file from a Python script. The file executes some commands that I need to run from Python.
import subprocess
name = open(“filename.bat”, “r”)
subprocess.run(name)
I see no ...
-1
votes
1
answer
31
views
Python subprocess FILE NOT FOUND error when executing a PyInstaller generated file in Linux from a shared VOLUME under DOCKER
I have generated an executable, say,test (no extension since it's Linux) using PyInstaller and stored it in a directory, say data.
I have a Python program that is as below:
import subprocess
from ...
1
vote
2
answers
18
views
Cannot use fileinput.input as stdin in subprocess.run
I was under the impression that fileinput.input([path_1, path2, ...]) is basically interchangeable with open(path_1) except that the former concatenates the contents of all the files given. However, ...
0
votes
0
answers
7
views
Python Subprocess - import file not found. I am able to execute child independently
I am on Python 3.12 and use venv. I have done pip install of PyMuPDF and able to use fitz pdf reader directly. However when I use subprocess to invoke the same program, i get an error that fitz not ...
0
votes
0
answers
32
views
Piping yt_dlp to FFMPEG using python: ffmpeg failing to recognize video data from pipe
I am trying to pipe the output of yt_dlp into a pipe used by ffmpeg which then outputs.:
def pipe_function(url):
ydl_command = [
'yt-dlp', '-f', 'bestvideo+bestaudio', '--quiet', '--no-warnings', ...
0
votes
0
answers
21
views
Execute Shell command after Switching to another user in Python [duplicate]
I am looking for a solution in which I should be able to do following in Python:
Login to a unix system with a generic user (user id/password);
Switch to another user who can not be directly logged ...
0
votes
0
answers
29
views
error after installing google-text-to-speech
trying to install google text to speech, got this:
error: subprocess-exited-with-error
× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> [23 lines of ...
0
votes
0
answers
10
views
i am trying to load data into hadoop using python but it is not working [closed]
i am trying ingest data into hadoop
(new-venv) hadoopuser@hadoop-master:~/my-venv$ python tesla.py
put: `/stock_data/historical_data.csv': File exists
Traceback (most recent call last):
File "/...
0
votes
1
answer
38
views
Cannot kill Popen process [duplicate]
I have a Python program with the following structure and necessary imports:
def startLogger(logger_dir):
command0 = 'adb logcat -c'
command1 = 'adb logcat'
command2 = 'python3 '+logger_dir+...
0
votes
0
answers
17
views
Running Scrapy via subprocess.run doesn't run via frontend api only runs via thunderclient and the likes
So i have a scapy spider nd i integrated it with my drf project by using subprocess.run but there's an issue the api call only runs successfully when i test it with thunderclient but when i try it by ...
0
votes
0
answers
20
views
Run shell command as another user using subprocess
I am trying to run a shell (bash) command using Python's subprocess module. However, I want to do this as another user. I am running my python script as root but my subprocess shell command needs to ...