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


Groups > comp.lang.python > #82277

Re: Solution to a problem,write terminal output to file

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!bcyclone02.am1.xlned.com!bcyclone02.am1.xlned.com!newsfeed.xs4all.nl!newsfeed3a.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!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.008
X-Spam-Evidence '*H*': 0.98; '*S*': 0.00; 'configure': 0.05; 'output': 0.05; 'subject:file': 0.07; '(aka': 0.09; 'cc:addr :python-list': 0.11; 'python': 0.11; 'suggest': 0.14; 'different,': 0.16; 'programmatic': 0.16; 'stderr': 0.16; 'stdout': 0.16; 'appropriate': 0.16; 'wrote:': 0.18; 'wed,': 0.18; 'trying': 0.19; 'coding': 0.22; 'email addr:gmail.com&gt;': 0.22; 'cc:addr:python.org': 0.22; 'error': 0.23; 'keyboard': 0.24; 'subject:problem': 0.24; 'file.': 0.24; 'cc:2**0': 0.24; '&gt;': 0.26; 'header:In-Reply-To:1': 0.27; 'chris': 0.29; 'am,': 0.29; 'dec': 0.30; 'robert': 0.30; 'message-id:@mail.gmail.com': 0.30; "i'm": 0.30; 'url:mailman': 0.30; 'code': 0.31; 'explained': 0.31; 'produces': 0.31; 'file': 0.32; 'probably': 0.32; 'run': 0.32; 'linux': 0.33; 'url:python': 0.33; 'running': 0.33; 'entirely': 0.33; 'could': 0.34; 'problem': 0.35; 'something': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'machine.': 0.36; 'url:listinfo': 0.36; "didn't": 0.36; 'url:org': 0.36; 'two': 0.37; 'server': 0.38; 'skip:& 10': 0.38; 'files': 0.38; 'that,': 0.38; 'skip:& 20': 0.39; 'sure': 0.39; 'either': 0.39; 'url:mail': 0.40; 'signal': 0.60; 'simply': 0.61; "you're": 0.61; 'to:addr:gmail.com': 0.65; 'press': 0.70; 'subject:,': 0.80; 'subject:Solution': 0.84; 'capture': 0.91
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=tikTG2WNcuerLOzJtUD8rOhDlXVeI48EpCnE26j2EvM=; b=phNyyt/TA8EGWndHt8QGVL1e3iBxQ0ScMhFfQmswGI/LsbqlG1eM3GgufanDGkuOI4 KjnUgcWdn2mWwzH3RC6YcUpKlsdnC6kK6IzTJL90TguNiMCZFD2VRK5wXXjBvBUXFr/3 yl2R9pHyzsUEiA44SOAMS8qwQ9bLU97wikyXL8fSrfgHuTSbRno+TkodPebRNWC2KJMS dLZkCCD/PWX92NO6AthzckVCTKEb20W89xE7rpCtN1+1GSn5Yy/OJpmF8wRX82qVaD4d +Pzb3/xrS38vv1aAw+lXtYQ+CEDuihKUhxNEDO8/sYUpY8eIyHr1llbiygdhyKolJR00 QPVw==
MIME-Version 1.0
X-Received by 10.202.228.136 with SMTP id b130mr1942303oih.128.1418206959953; Wed, 10 Dec 2014 02:22:39 -0800 (PST)
In-Reply-To <CAPTjJmqGKD0MDKBr=oEHmuJck61qSZW94ePebD=NRAxO7=LN1Q@mail.gmail.com>
References <CAEMktPWjN0m7m_YFNjcJBJ3xgh46rJXY+5pfQ93fD9xqX88ryw@mail.gmail.com> <CAPTjJmqGKD0MDKBr=oEHmuJck61qSZW94ePebD=NRAxO7=LN1Q@mail.gmail.com>
Date Wed, 10 Dec 2014 15:52:39 +0530
Subject Re: Solution to a problem,write terminal output to file
From Robert Clove <cloverobert@gmail.com>
To Chris Angelico <rosuav@gmail.com>
Content-Type multipart/alternative; boundary=001a114038b810eb680509da0a34
Cc "python-list@python.org" <python-list@python.org>
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
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.16805.1418206969.18130.python-list@python.org> (permalink)
Lines 129
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1418206969 news.xs4all.nl 2959 [2001:888:2000:d::a6]:34405
X-Complaints-To abuse@xs4all.nl
X-Received-Bytes 9355
X-Received-Body-CRC 880782978
Xref csiph.com comp.lang.python:82277

Show key headers only | View raw


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

I think i didn't explained well
Two programs client and server in c.
to run client strace -c ./client
to run server strace -c ./server

After a minute i want to send client SIGINT signal and capture the terminal
output in a file.

If i use os.system and press ctrl+c signal from keyboard i get the output
on terminal if i use subprocess.Popen and press ctrl+c from keyboard i
didn't get the output.

Regards


On Wed, Dec 10, 2014 at 12:51 AM, Chris Angelico <rosuav@gmail.com> wrote:

> On Wed, Dec 10, 2014 at 4:11 AM, Robert Clove <cloverobert@gmail.com>
> wrote:
> > I am facing a problem in python coding that is
> >
> > I have a client server program(programs a re in c code and client and
> server
> > are its executable) on Linux machine.
> > To run client i do this ./strace -c client and to run server i type this
> > ./strace -c server
> >
> > When i give ctrl+c to client i see some output on the terminal, i want
> that
> > output in the file i mean i want to send the ctrl+c signal programmatic
> ally
> > to client after a minute and write the output in the file.
> >
> > if i use subprocess.Popen to execute  ./strace -c client and give ctrl+c
> > signal i don''t see any output on the terminal but if i see os.system to
> > execute ./strace -c client i see the output on terminal.Now i want to
> send
> > the ctrl+c signal to os.system and write the terminal output into a file.
>
> I'm not entirely sure what you're trying to do here, but strace
> produces its output on Standard Error (aka "stderr"). You can simply
> redirect that to a file. That's the normal strace program. You might
> be running something completely different, since you're running
> "./strace"; but I would suggest that it probably uses either stderr or
> stdout ("Standard Output"), and you could redirect either or both. Try
> this, at the terminal (no Python involved):
>
> ./strace -c client >client_out 2>client_err
>
> Then press Ctrl-C, and see which of the files has the output. Based on
> that, you could configure subprocess.Popen to send the appropriate
> stream to a file.
>
> ChrisA
> --
> https://mail.python.org/mailman/listinfo/python-list
>

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


Thread

Re: Solution to a problem,write terminal output to file Robert Clove <cloverobert@gmail.com> - 2014-12-10 15:52 +0530

csiph-web