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
1 answer
Python, converting png to gif using ImageMagick
I am using Python 2.7.6, i had a problem converting some png files into gif (in order to create an animation)
os.system("convert -delay 1 -dispose Background +page " + str(output_dir)
+ "/*.png -loop 0 " + str(output_dir) +…

user3320936
- 3
- 1
- 5
0
votes
1 answer
How to assign output of os.system to a variable
I want to run this command from python
/opt/vc/bin/vcgencmd measure_temp
when I run it in python it prints the temperature to the screen and returns 0. When I try to assign it to a variable it assigns 0 too.
>>> import os
>>>…

DarylF
- 716
- 3
- 9
- 24
0
votes
1 answer
ValueError using nosetest subprocess
I would like to have the same output that I got when I executed os.system:
os.system('nosetests TestStateMachine.py:FluidityTest.test_it_has_an_initial_state -v')
test_it_has_an_initial_state (TestStateMachine.FluidityTest) ...…

hudsonsferreira
- 207
- 2
- 13
0
votes
2 answers
how to take an ipaddress as a input in python
While doing this it gives me an error:
Traceback (most recent call last):
File "C:\Users\ibrahim\Desktop\app.py", line 23, in
a=input("enter the ipaddress")
File "", line 1
192.168.1.1
^
…

ibrahim haleem khan
- 53
- 10
0
votes
2 answers
In a Python 2.4 script, I would like to execute a os system call `ls -l` or `curl` for example and capture the output in a variable. How to do this?
I am writing a python script on a remote server with an old version of python 2.4.
In the script I want to issue commands like curl -XPUT 'http://somerul/_search' -d file.txt or an ls -ltrh and capture the outputs of these commands into a variable.…

Horse Voice
- 8,138
- 15
- 69
- 120
0
votes
2 answers
How to display a .py on CMD with only python script?
I am working on an API made using Python called Cobra, and it does exactly what Python does. Here is my code:
import os
x = 1
print("Cobra Programming Language 3.3.2")
print("\n\nThe new version of Python programming, but with an all new…

Raihaan-Tech
- 5
- 4
0
votes
1 answer
Event loop in Python for CMD interaction
I've seen a few questions similar to this one, but none that really help my particular situation. I have a script that loops through a directory of text files, each of which has one one-line script command in it which needs to be run through command…

thnkwthprtls
- 3,287
- 11
- 42
- 63
0
votes
2 answers
Looking for Help Understanding sed commands in os.system() Python lines
I am working on translating some code I have written into a parallel process to be distributed on a computer cluster at my home university. In order to prepare to write my script for the cluster, I began by reading one of the sample snippets of…

duhaime
- 25,611
- 17
- 169
- 224
0
votes
2 answers
os.system command to call shell script with arguments
I am writing a python script which uses os.system command to call a shell script.I need help understanding how I can pass the arguments to the shell script? Below is what I am trying..but it wouldn't work.
os.system('./script.sh arg1 arg2 arg3')
I…

user2727202
- 11
- 1
- 1
- 1
0
votes
2 answers
Invoking 64-bit console from 32-bit python
I'm attempting to write a script that will gather the output of a few basic windows commands into a set of files, and am finding my vssadmin commands frustrating. The command is a relatively simple
os.system('vssadmin list writers>>…

jgeller
- 3
- 4
0
votes
2 answers
Python: system command
I spend a few hours writing a little script.
Basically what it does is create a new text file and fills it up with whatever.
I zip the text file --using zipfile-- and here's where my problem lies.
I want to run the Windows system command:
copy /b…

user2681562
- 513
- 1
- 4
- 5
0
votes
2 answers
Why are os.system and subprocess.call spawning so many processes?
import os
import subprocess
import sys
import re
## fname_ext=sys.argv[1]
fname_ext=r"C:\mine\.cs\test.cs"
exe=os.path.splitext(fname_ext)[0]+".exe" #…

Plakhoy
- 1,846
- 1
- 18
- 30
0
votes
2 answers
Using os.system to print in Python using Linux
I have searched everywhere for this and could not find an answer. I am using os.system to print to a printer, but it prints it off as a portrait and I need it to print off as Landscape. I assume there is a simple way to add something within the…

hunter21188
- 405
- 2
- 7
- 29
0
votes
2 answers
Telnet not working for os.system call
Why cant I call the following in python using os?
import os
os.system('telnet 1.1.1.1')
yet when I open a terminal and use the exact command, I can telnet. I get the following when running the code:
'telnet' is not recognized as an internal or…

JonStanley91
- 19
- 1
- 6
0
votes
1 answer
Fetching the output of a command executed through os.system() command
I am using a script where I issue a shell command to a remote server (ssh) using os.system() command. I need to collect the output of the command I executed on the remote server. The problem is the double redirection. I am using the os.system() to…

csurfer
- 296
- 1
- 7