Skip to main content

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.

0 votes
0 answers
11 views

Execute Shell command after Switching to another user in Python

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 ...
Praveen Mishra's user avatar
0 votes
0 answers
20 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 ...
Jackson Morris's user avatar
0 votes
0 answers
8 views

i am trying to load data into hadoop using python but it is not working

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 "/...
Onuh John Edoh Adanu's user avatar
0 votes
1 answer
33 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+...
Priyansh Gupta's user avatar
0 votes
0 answers
15 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 ...
Programmer's user avatar
0 votes
0 answers
17 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 ...
Parth Shah's user avatar
  • 1,375
0 votes
1 answer
53 views

Getting the result from a future in Python

I have the following code which executes a process and calls a callback function when the process is done import os import subprocess import tempfile def callback(future): print(future....
Peter Kronenberg's user avatar
0 votes
0 answers
32 views

Python subprocess.Popen.communicate() does not wait for the process to complete

On Ubuntu 22, using Python 3.10, I need to set up a VPN connection and analyze the response from the VPN server. I do this as follows: connect_command = ['ip', 'netns', 'exec', 'vpn_test_namespace', '...
Serg's user avatar
  • 1
0 votes
1 answer
42 views

"Operation not permitted" when trying to compile code in Databricks

I am trying to compile my code in Databricks using the following code: import subprocess process = subprocess.Popen(["python", "setup.py", "bdist_wheel"], ...
Iqram Choudhury's user avatar
1 vote
1 answer
38 views

How can I redirect stdout and stderr of subprocess in python to same file without losing the order

I have a simple script to mimic a program writing to stdout and stderr streams interleaved. import sys import time for i in range(5): print(int(time.time()), "This is Stdout") print(...
Krishna's user avatar
  • 1,226
1 vote
0 answers
36 views

Variables set inside the rcfile are NOT accessible through Python

I've a shell script and a python script organized as follows (CAN NOT change the directory structure): ~ ├── a.py ├── b └── c.sh The MWEs are as follows: c.sh #!/bin/sh rcfile=$(mktemp) export ...
dibyendu's user avatar
  • 525
0 votes
0 answers
23 views

Subprocesses from within an Inkscape extension

I have a couple instances in which I cannot seem to be able to run subprocesses from within an Inkscape extension. One is this case: def close_dialog(self, name=None): try: ...
simone's user avatar
  • 5,045
0 votes
0 answers
13 views

python subprocess modify incoming stream and printing it live

Note: This seems like a solved problem, but I couldn't find a solution. I have some command line utility I need to use. For example something like import sys, time for i in range(3): print('...
FrontendC's user avatar
  • 369
1 vote
0 answers
40 views

Pass Subprocess Output to GUI Live

I have a python program that wraps another program I'm running with subprocess.run(). The program has a great console output that I'd like to show in the GUI: I'm struggling to figure out how to ...
cndnflyr's user avatar
  • 173
1 vote
0 answers
24 views

Runing a script written for python2.7 using subprocess.run in a script written in python3.11

In my company there is a script: install.py that is written in python2.7. The issue I'm writing a script to run this script from my own python script which I've written in python3.11. In the beginning ...
Saar Katz's user avatar

15 30 50 per page
1
2 3 4 5
823