Python script output in file
Robert Clove
cloverobert at gmail.com
Wed Mar 18 06:35:35 EDT 2015
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"
filename = logfilename+packetsize+'-'+formated_string+'.txt'
logfile = open("/root/Desktop/speed.txt", 'w')
proc=subprocess.Popen(comand8,shell=True,stdout=subprocess.PIPE,stderr=subprocess.PIPE)
for line in proc.stdout:
logfile.write(line)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20150318/8549d065/attachment.html>
More information about the Python-list
mailing list