On Wednesday, March 18, 2015 at 4:06:05 PM UTC+5:30, Robert Clove wrote: > Hi, > > I have a perl script named "my_eth-traffic.pl" which calculates the tx and rx > speed of the Ethernet interface in Mb. > > I want to run this script from another script and want the output in other > file. > So i wrote the following script but not getting the output. > > > #!/usr/bin/python > > import sys > import subprocess > import datetime > import os > import time > > comand8 = "/root/Desktop/my_eth-traffic.pl eth0 M"
>From Popen docs https://docs.python.org/2/library/subprocess.html#subprocess.Popen Note in particular that options and arguments that are separated by whitespace in the shell go in separate list elements, while arguments that need quoting or backslash escaping when used in the shell (such as filenames... So (I guess) you should try comand8 = ["/root/Desktop/my_eth-traffic.pl", "eth0", "M"] Or better comand8 = ["perl", "/root/Desktop/my_eth-traffic.pl", "eth0", "M"] containing spaces or the echo command shown above) are single list elements. -- https://mail.python.org/mailman/listinfo/python-list