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.

-1
votes
0answers
16 views

Keep both changes in git

Hi how to keeps both changes in git through commandTo accept current change we use the following command git checkout --ours filenameTo accept the incoming change we use the following commandgit ...
0
votes
0answers
15 views

Connect to SAS Compute and execute .sas file with Paramiko and Sub Process in Python [duplicate]

I have some code that connects SSH connects to the SAS compute server using Paramiko from a SAS Windows client machine and the attempts to execute a piece of .sas code that has been exported from an ...
1
vote
0answers
21 views

How to terminate long-running computation (CPU bound task) in Python using asyncio and concurrent.futures.ProcessPoolExecutor?

Similar Question (but answer does not work for me): How to cancel long-running subprocesses running using concurrent.futures.ProcessPoolExecutor?Unlike the question linked above and the solution ...
0
votes
1answer
23 views

Python OSError: [Errno 2] No such file or directory ERROR

I'm having troubles with running OS commands on Linux through python (which i did LOTS of time in the past)I'm trying to run a simple OS command, using the subprocess module:def test_func():...
0
votes
1answer
19 views

log INFO from shell script are not displaying when we trigger shell script from python program

I am calling shell script from my pyhton program and the shell script is having INFO & DEBUG logs as part the output.When i run the shell script from python program, i can see only standard ...
0
votes
0answers
20 views

Submitting a large file using subprocess check_all in parallel

I have a code which compromises of making an input file and submitting it to an executable using subprocess.check_all. Unfortunately the process is too slow. The input file size usually tends to be ...
0
votes
0answers
32 views

Docker file with python script to get end of process output

I have written docker file to call python script that will execute the process and copy the result. On running the python script, it work as expected, but on calling python script with docker it doesn'...
0
votes
1answer
26 views

Using Python to run a sourced script, cd, and then run a command within the SAME shell

How can run a sourced bash script, and then change directories, and then run a command, all within the same shell (Using python)? Is this even possible?My Attempt:subprocess.check_call(["env -i ...
1
vote
1answer
18 views

CUDA error: out of memory when using subprocess to launch multiple training process in Pytorch

I am training some neural networks, and I have a script to search for hyperparameters. """Peform hyperparemeters search"""import argparseimport osfrom subprocess import check_callimport sys...
0
votes
0answers
27 views

Python Script Running John the Ripper

I'm working on a school project and I have to run John the Ripper through as a python script. Currently I'm running the command like this.subprocess.run(['john --wordlist=/usr/share/john/password....
2
votes
3answers
31 views

Popen.communicate is stuck until process spawned by sub-process terminates

I have the below three scripts, and when I run main.py file, it spawns child.py which again executes the subchild.py and terminates quicly, subchild.py however keeps executing for a lot of time.The ...
8
votes
3answers
94 views

Achieving shell-like pipeline performance in Python

[Edit: Read accepted answer first. The long investigation below stems from a subtle blunder in the timing measurement.]I often need to process extremely large (100GB+) text/CSV-like files containing ...
0
votes
1answer
12 views

Python subprocess: get all stdout data after proccess has terminated

I am using subprocess in python to invoke another executable, write some data to it's stdin (close the stream once everything is written - which is how the sub process knows it's recieved everything) ...
-1
votes
0answers
12 views

Python Popen(): Have errors processed asynchronously from another thread [duplicate]

I am running a long-running subprocess with Python Popen(). stdout is returned and used for data processing. However, the subprocess might send something to stderr every now and then. Some of these ...
0
votes
3answers
53 views

How to run a shell script in python from memory?

The application I'm writing retrieves a shell script through HTTP from Network, I want to run this script in python however I don't want to physically save it to the hard drive because I have its ...
1
vote
1answer
17 views

Pyhon execute action when application launched via sub-process is closed

I'm sure this is already answered but I cannot find anything from the search, maybe I'm not using the correct keywords.OK, in short > I'm running an application via python sub-process and I would ...
0
votes
1answer
34 views

os.system() and subprocess.call() behave differently

I have a script that launches Scribus with a specific file and automatically runs a Python script inside of Scribus.I now want to pass further options to the Scribus script, but while doing that, I ...
0
votes
1answer
19 views

How to read from subprocess in aiohttp?

I have a very simple server which reads from a subprocess and passes the data to any opened websockets. The problem I'm running into is that my approach to reading from the subprocess seems to break ...
0
votes
1answer
6 views

Python 2.7: Call to subprocess.popen blocks file access

I am trying to develop a simple function that opens a file, starts a sub-process, then closes the file, then moves the file to a different location and then stops the sub-process. What happens ...
0
votes
1answer
198 views

ImageMagick not authorized to convert PDF to an image

I have a program, in which I need to convert a PDF to an image using Image Magick. I do that using the subprocess package:cmd='magick convert -density 300 '+pdfFile+'['+str(rangeTuple[0])+'...
0
votes
0answers
18 views

Change subprocess title

I start a console EXE application in my Python application using subprocess.call like that:subprocess.call("exelocation.exe", cwd=os.getcwd())So, this works fine... but the EXE application's title ...
1
vote
0answers
12 views

Why does Popen's poll function wait forever when exit code is 0?

Take this first script slave.py:import sysprint('hello')sys.exit(0)I am calling it from another script, waiting for it to end:import shleximport subprocessimport timep=subprocess.Popen(...
0
votes
0answers
19 views

Executing bash script and setting environment variables using python

I have been trying to use the sub-process module to run a sequence of shell commands in succession, to automate certain tasks using python(for the first time). The following are the steps involved in ...
0
votes
1answer
15 views

How to open the Device Manager with Python

How do I open the Device Manager with python? I use the subprocess library:import subprocesssubprocess.call("devmgmt.msc")I get this error:File "c:\Wichtig\python\admpwd\admpwd.py", line 3, ...
0
votes
1answer
32 views

subprocess.check_output(..) process returning the same output when run in loop

I am a novice in python. So please bear with me :) I want to write a script which will check the CPU utilization of the system and in case it crosses a threshold, it should take thread dumps along ...
0
votes
1answer
11 views

subprocess.Popen hangs main application

I'm trying to follow an example of code that I found here and I've modified the code a bit so it looks like this in my main application def send_to_printer(pdffile):acrobat=r'C:\Program Files ...
-1
votes
0answers
13 views

Alternative to stdout.readline() from subprocess.Popen in Python 2.7

I am trying to read from a program similar to tail line by line but under Windows OS, however it's mandatory to not have console open, and preferably button-less windows showing current application's ...
0
votes
0answers
21 views

Windows: self replacing python script

I have a python script frozen with pyinstaller. Now I want the resulting exe to replace itself. Is there a way?I thought of using something likefrom subprocess import Popen, PIPE, TimeoutExpired...
0
votes
1answer
34 views

How do you successfully invoke gsutil rsync from a python script?

I am trying to execute the following line gsutil -m rsync s3://input gs://outputin python. When running this line in the shell terminal it works fine. However, I am trying to run this in a python ...
0
votes
1answer
22 views

Redirect output of a command made in cmd to a variable in Python 3

I want to get the output of a python script which is made to run in cmd to a variable in the host script. I am partially able to do it but not getting the desired output. Please guys before downvoting ...

153050per page
angop.ao, elkhabar.com, noa.al, afghanpaper.com, bbc.com, time.com, cdc.gov, nih.gov, xnxx.com, github.com,