os.system is a python standard library function. It executes the given string argument as a command in a subshell.
Questions tagged [os.system]
638 questions
0
votes
2 answers
Run independent file from main
I have a run.py that looks something like this:
def main():
# Tested and working code here
if __name__ == '__main__':
main()
Then I have another file that runs a TCP Socket Server, bup.py:
import socket
import os
from threading import…

P I N C O
- 76
- 2
- 11
0
votes
1 answer
Is there a way to change the SHELL program called by os.system()?
I’m in an embedded environment where/bin/shdoesn’t exist so when I callposix.system()or os.system()it always returns-1.
Because of that environment, thesubprocessmodule isn’t available. I can’t create pipes too.
I’m using ɴᴀᴄʟ as glibc.
Setting…

user2284570
- 2,891
- 3
- 26
- 74
0
votes
3 answers
Sharing data with multiple python programms
i am scraping data through multiple websites.
To do that i have written multiple web scrapers with using selenium and PhantomJs.
Those scrapers return values.
My question is: is there a way i can feed those values to a single python program that…

solidsnake
- 13
- 3
0
votes
1 answer
Using $* as part of a parameter for os.system in python
The command:
make foo -f $*
Has different functionality when called from the command line versus when it is called from a python script as follows:
import os
os.system(make foo -f $*)
As stated here:…

Shani de Leeuw
- 171
- 1
- 11
0
votes
3 answers
grab serial input line and move them to a shell script
I tries to grab a uart - line and give this string to a shell script;
#!/usr/bin/env python
import os
import serial
ser = serial.Serial('/dev/ttyAMA0', 4800)
while True :
try:
state=ser.readline()
print(state)
except:
pass
So,…

dokle
- 3
- 1
0
votes
1 answer
Why the below ntfy command is not working with os.system() function?
On executing: ntfy send 'Hello'
through Windows cmd/Powershell, I am able to get a desktop notification. However, on executing the below command in Python 2.7 shell, I am getting error that 'ntfy is not recognised as internal or external command' in…

kpratihast
- 842
- 1
- 10
- 23
0
votes
1 answer
Open applications with Python, doesn't work when there are spaces in app name
I am trying to open applications using python. At the moment, this is what I have got:
os.system("open " + "/Applications/" + app + ".app")
('app' is a string with an appname, changes throughout the script)
Now, my problem is that this works…

Robin
- 360
- 1
- 2
- 11
0
votes
0 answers
cp: cannot create regular file `/dev/usb/lp0': No such file or directory
I'm writing an auto-testing script right now. My build environment is Linux with Python 3.
My program stuck when it runs to the command:
os.system('cp '+ file_name + ' '+ usb_port)
where it reports:
cp: cannot create regular file `/dev/usb/lp0':…

Jacky Zhang
- 47
- 1
- 1
- 5
0
votes
1 answer
python os.system use 2 quotes in bash command
I am creating a simple script that simplifies an SMS bash command.
in bash the command looks like this:
curl http://textbelt.com/text -d number=0000000000 -d "Message=Test01"
The problem is, when I put that into python it looks like this:
import…

Liam McElhaney
- 17
- 5
0
votes
2 answers
how to use tornado to make async ping?
A very simple tornado app, when server receive a HTTP get request, it ping -c 2 www.google.com, then return the result. And I want use Tornado. Here is the code from an article.
class AsyncTaskHandler(tornado.web.RequestHandler):
…

Herbert Kwok
- 1
- 2
0
votes
1 answer
How do I get the log file a program creates when running it with subprocess.call()?
I work with Gaussian, which is a program for molecular geometry optimization, among other applications. Gaussian can take days to end a single optimization so I decided to make a program on Python to send me an e-mail when it finishes running. The…

Daniel Watanabe
- 3
- 5
0
votes
1 answer
Python 3 and mpg321 formating
Im having some problems playing a random sound using mpg321.
First I make a list of all the sounds and also store the length in a variable I then create a random number between 0 and the length of that list. My problem is I do not know how to add…

Loxstomper
- 11
- 4
0
votes
1 answer
Make Python wait for commands to end
I have a python program which dynamically move and rename files into a hadoop cluster. The files usually range from 10mb(parsed) up to 1.5gb (raw data). For the move commands to finish it can take a while and from what I can tell python races…

Sam
- 293
- 3
- 19
0
votes
0 answers
Can I specify which instances of a program to kill with "TASKKILL"?
I have the following code:
import os
os.system("TASKKILL /F /IM notepad.exe")
I am aware that this command will forcefully kill the "notepad.exe" process.
What I would like to know is, can I make that command more specific?
If I had both…
user3982689
0
votes
3 answers
How do I get data from stdin using os.system()
The only reliable method that I a have found for using a script to download text from wikipedia is with cURL. So far the only way I have for doing that is to call os.system(). Even though the output appears properly in the python shell I can't seem…

GameFreak
- 2,881
- 7
- 34
- 38