All Questions
Tagged with sys subprocess
40 questions
-1
votes
1
answer
287
views
Error regarding subprocess install in python
import sys
import subprocess
subprocess.check_call([sys.executable, '-m', 'pip', 'install', openpyxl])
import openpyxl
I am trying to install openpyxl using subprocess and sys module, but get error ...
0
votes
0
answers
46
views
How to get the current line from python's subprocess module
I am trying to accomplish a pseudo console with python's subprocess module for my web app.
The point of the webapp is to be able to run and interact with python code via the web.
I have a simple test....
-1
votes
1
answer
142
views
How to pass more than two string/variables to my child script when using subprocess?
[1] Can I pass an integer or even a list to my child script(test.py)? How do I do so?
[2] How should I modify my code if I also want to pass the age variable to the child script (test.py) and print ...
0
votes
1
answer
319
views
Python return variable based on sys/argv input from subprocessed child script [duplicate]
I have two Python scripts, a parent script (parent.py) which passes a value to the child script through subprocess, and a child script (child.py), which uses the argument given in subprocess to return ...
0
votes
1
answer
487
views
local variable 'subprocess' referenced before assignment
Here is it my code, I'm trying to perform command in commandline and get output, but I got error. Please help me
import telebot
import subprocess
token = ''
bot = telebot.TeleBot(token)
@bot....
0
votes
0
answers
250
views
redirect module function stdout to flask socket
I have a file with a function that counts to 15 in a for loop. I want to redirect the output to a socket.
test.py
def counttest():
x = 0
for x in range(0,15):
x = x+1
print(&...
4
votes
0
answers
569
views
How to send an input to a running program in the command prompt in python
(i'm italian, sorry for grammar errors)
I have made a simple programming language. In this language, to run an external file, you have to type 'RUN("file_name.extension")'. Then i started ...
1
vote
1
answer
485
views
How to check if not one but any Popen subprocess at all is still running?
I know there is the possibility to check if a subprocess is still running with .poll(). So for example:
p = subprocess.Popen(...
"""
A None value indicates that the process hasn't ...
0
votes
1
answer
267
views
Using stdout and stdin in a loop in python leading to errors
I am using stdout and stdin to communicate information between two python programs. tester.py should pass telemetry data into helper.py and helper.py should return some command to tester.py.
This ...
0
votes
1
answer
50
views
Execute method from another python file with argues
I'm a python begginer and I wanted to execute a method (A) with argues that will call another method (B) that will return values to (A).
I only can't reached the (B) method directly, for this I used a ...
2
votes
8
answers
6k
views
How to change part of files names using Sys and Subprocess modules and Linux Bash
I have Python script which reads files names from oldFiles.txt, iterate through files names which are files in a Linux directory, then update the files names using string.replace and finally run a ...
0
votes
1
answer
147
views
terminal partitioning for each of subprocesses prints
Say we have multiple subprocesses like the following which has some results printed in real time to sys.stdout or sys.stderr.
proc1 = subprocess.Popen(['cmd1'],
env=venv1,
...
2
votes
1
answer
829
views
accessing python interpreter from a pyinstaller bundle #2
I'm trying to execute a python script which is included in datas, and bundled into a pyinstaller executable (on a mac). I need to pass parameters to this script, so I can't just exec(open(read()). ...
0
votes
0
answers
27
views
Python how to call another python script using subprocess.call and get the correct return value [duplicate]
If I have a script 'sp_test.py' as follows:
import sys
def sp_test(a=0,b=0,c=0):
print(a)
print(b)
print(c)
return str(a)+str(b)+str(c)
if __name__ == "__main__":
sp_test(sys....
0
votes
1
answer
77
views
How would I fix this script with the wrong output?
It is messing up in multiple ways
Here is the code:
import threading
import sys
import time
import os
import subprocess
import requests
import threading
ip = sys.argv[1:]
website_loaded = False
...