Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #87673

Python script output in file

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!backfill.erje.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed4a.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <cloverobert@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.006
X-Spam-Evidence '*H*': 0.99; '*S*': 0.00; 'output': 0.05; 'subject:Python': 0.06; 'subject:file': 0.07; 'sys': 0.07; 'filename': 0.09; 'subject:script': 0.09; 'wrote': 0.14; "'w')": 0.16; 'calculates': 0.16; 'import': 0.22; 'to:name:python- list@python.org': 0.22; 'file.': 0.24; 'script': 0.25; 'skip:" 30': 0.26; 'message-id:@mail.gmail.com': 0.30; 'getting': 0.31; 'perl': 0.31; 'interface': 0.32; 'run': 0.32; 'another': 0.32; 'skip:# 10': 0.33; 'skip:& 30': 0.33; 'but': 0.35; 'received:google.com': 0.35; 'hi,': 0.36; 'to:addr:python-list': 0.38; 'skip:& 20': 0.39; 'to:addr:python.org': 0.39; 'skip:o 30': 0.61; '\xc2\xa0\xc2\xa0': 0.74; 'skip:p 80': 0.84
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=2VdqOz7cQ7fukdbjtghgo4BBL/xM20lbmk7kXK8pY2M=; b=HKQPlGqAYcSqqcY9j9cra41rLg9CQwMMR6uNRkfCk/hl6Wvc6jQZyuXv4otu6ojgaB k7WWitVog/h0rqxJMNKxTU+2Y4jEjfPUdaK6EJRnhZLjKQlAKf84QPmkT/j//QQH1vjA 8UvPRXccm9tzTUCS6is6XIPUsyr2zTaBZ2Bf5zToT0ZKIlAlMiHsHUMe8PJa6APWIqQO 8LGNOLIR5V98hyPAYzeS4Rq/o+CV78G/bYCdi1gcSZ7fMkyVq/fi++h7PRxgIgJWV0hS CAhwghIuteHwUYrbHt7AlLwDves2AvqFYLPWkJnVDsLCPEJNDCbjbGJbHM4b5NEteYGf Zs9A==
MIME-Version 1.0
X-Received by 10.202.188.66 with SMTP id m63mr53734787oif.14.1426674935250; Wed, 18 Mar 2015 03:35:35 -0700 (PDT)
Date Wed, 18 Mar 2015 06:35:35 -0400
Subject Python script output in file
From Robert Clove <cloverobert@gmail.com>
To "python-list@python.org" <python-list@python.org>
Content-Type multipart/alternative; boundary=001a113dd688b9c9b105118da4da
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.19
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.520.1426674938.21433.python-list@python.org> (permalink)
Lines 51
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1426674938 news.xs4all.nl 2896 [2001:888:2000:d::a6]:35522
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:87673

Show key headers only | View raw


[Multipart message — attachments visible in raw view] - view raw

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)

Back to comp.lang.python | Previous | NextNext in thread | Find similar | Unroll thread


Thread

Python script output in file Robert Clove <cloverobert@gmail.com> - 2015-03-18 06:35 -0400
  Re: Python script output in file Rustom Mody <rustompmody@gmail.com> - 2015-03-18 03:49 -0700
    Re: Python script output in file Robert Clove <cloverobert@gmail.com> - 2015-03-18 07:41 -0700
      Re: Python script output in file Rustom Mody <rustompmody@gmail.com> - 2015-03-18 11:06 -0700
        Re: Python script output in file Rustom Mody <rustompmody@gmail.com> - 2015-03-18 11:10 -0700

csiph-web