How to wait in bash for several subprocesses to finish and return exit code !=0 when any subprocess ends with code !=0?

How to wait in a bash script for several subprocesses spawned from that script to finish and return exit code !=0 when any of the subprocesses ends with code !=0 ? Simple script: #!/bin/bash for i...

Using Python to execute a command on every file in a folder

I'm trying to create a Python script that would : Look into the folder "/input" For each video in that folder, run a mencoder command (to transcode them to something playable on my phone) Once...

How can I specify working directory for popen

Is there a way to specify the running directory of command in Python's subprocess.Popen()? For example: Popen('c:\mytool\tool.exe', workingdir='d:\test\local') My Python script is located in...

How to flush the input stream?

I'm writing a simple alarm utility in Python. #!/usr/bin/python import time import subprocess import sys alarm1 = int(raw_input("How many minutes (alarm1)? ")) while...

Python subprocess.Popen as different user on Windows

What is the best manner of launching a subprocess as a different user in Python on Windows? Preferably XP and up, but if it works only on Vista and 7, I can live with that too.

Can you "stream" images to ffmpeg to construct a video, instead of saving them to disk?

My work recently involves programmatically making videos. In python, the typical workflow looks something like this: import subprocess, Image, ImageDraw for i in range(frames_per_second *...

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

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. I cant however make this work from python with...

Duplicate stdout, stderr in QTextEdit widget

I've been having difficulty with my PySide program for a few days now. I don't think the problem is incredibly difficult because there are answer out there. Problem I have is none of them seem to...

OSError: [WinError 193] %1 is not a valid Win32 application

I am trying to call a Python file "hello.py" from within the python interpreter with subprocess. But I am unable to resolve this error. [Python 3.4.1]. import subprocess ...

Mocking a subprocess call in Python

I have a method (run_script) would like to test. Specifically I want to test that a call to subprocess.Popenoccurs. It would be even better to test that subprocess.Popen is called with certain...

How to speed up process of loading and reading JSON files in Python?

I am running a script (in multiprocessing mode) that extract some parameters from a bunch of JSON files but currently it is very slow. Here is the script: from __future__ import print_function,...

Convert SVG/PDF to EMF

I am looking for a way to save a matplotlib figure as an EMF file. Matplotlib allows me to save as either a PDF or SVG vector file but not as EMF. After a long search I still cannot seem to find a...

Python Subprocess: Unable to Escape Quotes

I know similar questions have been asked before, but they all seem to have been resolved by reworking how arguments are passed (i.e. using a list, etc). However, I have a problem here in that I...

How to run a background process and do *not* wait?

My goal is simple: kick off rsync and DO NOT WAIT. Python 2.7.9 on Debian Sample code: rsync_cmd = "/usr/bin/rsync -a -e 'ssh -i /home/myuser/.ssh/id_rsa' {0}@{1}:'{2}' {3}".format(remote_user,...

Why can't the Python command "subprocess.Popen" find the jar file to run?

I'm trying to run code from this repo: https://github.com/tylin/coco-caption, specifically from https://github.com/tylin/coco-caption/blob/master/pycocoevalcap/tokenizer/ptbtokenizer.py, line...

key.char gives AttributeError when using Key.f5 in Python Pynput

Im trying to make a very simple program that presses the F5 key when I press another key (example q). Whenever I use regular characters a-z I compare using if key.char == 'q': This works fine...

running an R "subprocess" (fork) within plumber

I am trying to implement a rest API using plumber. What I would like to happen is that when the request arrives, R will start a background/secondary process, and the API should return immediately...

In Python, how do I get the path to a directory of files located within a module

I created a module called 'playr' that has a subdirectory of wav files: user/repositories/python_packages/playr/ | |--__init__.py |--sounds/ | |--sound1.wav | |--sound2.wav | ...

cannot find symbol import com.google.firebase.iid.FirebaseInstanceIdService error in ionic3

I Have no idea why I am getting this error whenever I try to create my app's build.I have tried many solutions but I was unable to solve this.i don't know if any plugins is causing issues or if...

python3 queue.put() blocking main

python3 queue.put() will block main process when queue size over particular value(1386). I use 30 subprocesses and two queue to count an int number, each subprocess get number from first queue and...

ionic cordova run android An error occured while running subprocess native-run

I am trying to run my ionic app on an android device (Xiaomi Pocophone) by running the following command: ionic cordova run android However, I get the following error message: BUILD SUCCESSFUL in...

cant open programs with ".lnk" extension using subprocess.call function

it seems subprocess.call function just can be used for the files with '.exe' extension. This is the code i tried for Firefox.lnk in which this is the same code i tried for a git program that has...

How to run a shell script in Jupyter Notebook?

So I have this shell script that runs a program that I'll be using in Jupyter, but is bash-oriented, and I tried using the subprocess module,and I get the error: OSError: [Errno 13] Permission...

can't install Mongodb properly from terminal ubuntu 18.04 LTS

I am trying to install mongodb on my Ubuntu 18.04 LTS from this site https://www.howtoforge.com/tutorial/install-mongodb-on-ubuntu/ . After I running this command : sudo apt-get install -y...

Multiprocessing memory leak, processes that stay around forever

I'm trying to solve a multiprocessing memory leak and am trying to fully understand where the problem is. My architecture is looking for the following: A main process that delegates tasks to a...

How to mock subprocess.run in pytest?

I have this class defined: class InternalProc: @staticmethod def get_data(): try: result = subprocess.run(['bridge-client', '--business-credentials'], ...

Not able to integrate ionic with capacitor , npm throws error

I have a blank ionic project , I am trying to integrate with capacitor with ionic to build android app. I run this command . ionic capacitor add android this throwing npm error please help me out...

Angular error on Ionic build: Cannot find module '@ionic/angular-toolkit/package.json'

When I run "ionic cordova build ios" I get the following error when ng is called: > ng run app:ionic-cordova-build:production --platform=ios 2021-09-29T09:57:54.068Z ng:analytics...

Is there a Python VPN API/GUI to start/stop a VPN client?

I am pretty new to Python yet I build a Selenium bot but I need to change my IP address with every different Firefox profile usage. For now I am basically using pywinauto.mouse.click to click my...

Discord member scraper

This script scrapes all members ids in a server and then saves the ids in ids.json, I want to make it save the ids after scraping a specific number of member ids. So for example I want it to...