Questions tagged [os.system]

os.system is a python standard library function. It executes the given string argument as a command in a subshell.

638 questions
0
votes
0 answers

Python gives broken pipe error and unable to write error while using os module

import os cmd='for file in /proc/*/status ; do awk \'/VmSwap/||/^Pid/||/Name/{printf "%-20s", $2 $3}END{ print""}\' $file; done | sort -nr -k 3 | head -5' os.system(cmd) output, i have added # , my question is , why am i getting broken pipe error…
shankar
  • 431
  • 7
  • 13
0
votes
0 answers

hooking the keyboard in multiple threads - pyhook and threading

Im trying to capture a set of words from the keyboard and run a coresponding command to each word. Each thread looks for a different word. For some reason although both threads are running only one word is captured. import pythoncom, pyHook, os,…
0
votes
0 answers

User Data in EC2 fails if python has os.system()

I found it faster to use aws s3 cp than boto to download files from s3 public repositories. For some reason if I use boto my job executes fine. If I use os.system('aws s3 cp s3://1000genomes/XXX /home/admin/data/XXX') the instance will download…
0
votes
1 answer

How to start an executable from a variable path

I'm not able to start an executable from a variable path. I've tried: os.system(destPath + '/BHC.exe') os.system(destPath/BHC.exe) the destPath is set correctly and the BHC.exe is in there. How can I start the external program?
Vroluk
  • 41
  • 1
  • 4
0
votes
1 answer

Checking gcc warnings using Python

Below is a small code segment in the python script I wrote. The purpose of the script is to compile various C files. (I modified the segment and simplified it to fit the purpose of the question.) fileName = "somefile.c" my_cmd = "gcc…
Avi Dubey
  • 794
  • 6
  • 16
0
votes
1 answer

Pass variable from php to python script and run os.system()

I need to set the date and time of my raspberry pi with a php script. After some research I use a php script to call a python script. My datetime.php : $date = '2015-09-05'; $output =…
0
votes
2 answers

python extract fields from os.system std out

pretty new to python. I'm trying to integrate this github project (https://github.com/elceef/dnstwist) into a more dynamic / automated tool that will periodically execute, look for new domains that have popped up, add them to a mysql database and…
dobbs
  • 1,089
  • 6
  • 22
  • 45
0
votes
2 answers

Python os.system with 2 variables and zip

Sry, my english skills are very low. My problem : I want start a EXE with the "os.system" function. It works... os.system("Engine\\2.75\\python\\python.exe TEST_GUI.py") So...now. This Code starts the Python EXE and starts my TEST GUI. But what is…
Kevin Bose
  • 21
  • 5
0
votes
1 answer

Python os.system('dir') points to 'C:\' not 'C:\myfolder\'

Python os.system('dir') points to 'C:\' instead of 'C:\myfolder\'. Any ideas why and how can I fix it? Environment: Windows 7, Python3.4
BongoClue
  • 23
  • 4
0
votes
3 answers

Broken pipe using os.system for get the folder size

I have a python script and I want to get the size of a folder (as fast as possible) like this: os.system("du -k folder |sort -nr| head -n 1 > size") Although it seems that works, I get this error sort: write failed: standard output: Broken…
Ren91
  • 5
  • 5
0
votes
6 answers

Need to use a variable in an os.system command in python

I am new to python and I need to use a variable in the os.system command, here's my code so far import os , sys s = raw_input('test>') then i want to use the varable s in an os.system command so I was thinking something like os.system("shutdown -s…
Rob
  • 172
  • 2
  • 3
  • 10
0
votes
1 answer

Executing a string in python using system.check_call

I'm a novice at Python programming. When I needed to execute some command-line commands inside a python script, I used to use subprocess.check_call, since I heard that this is better than os.system in several respects. For example, when I need to…
chanwcom
  • 4,420
  • 8
  • 37
  • 49
0
votes
1 answer

Function to Launch Another Python Script

I'm creating a program using Python/Tkinter and it involves a main screen with a bunch of buttons. Each button will launch another Python script in the same folder. I'm trying to create a function that will quit the script and open another. How can…
0
votes
1 answer

Call subprocess in python service

I have a strange problem.. I've created a python script (modbus_sensor.py), which runs as a service. Modbus_sensor.py calls around 15 other python scripts by a scheduler. When I run modbus_sensor.py like: "python modbus_sensor.py" it works…
0
votes
0 answers

Python line to run .jar works very strangely

I'm trying to run limelight.jar with parameters with Python. Opening a brand new Python 3 shell and entering this: os.system("java -jar /home/pi/Desktop/GGUIv0.8/limelight.jar stream -app Steam -notest 192.168.1.100") Works fine. It brings up Steam…
user5012239