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


Groups > comp.lang.python > #33053

RE: How to print python commands automatically?

Path csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <ramit.prasad@jpmorgan.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.000
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'output': 0.04; 'test,': 0.05; 'bash': 0.07; 'completeness': 0.07; 'subject:How': 0.09; 'python': 0.09; 'received:155': 0.09; 'subject:skip:a 10': 0.09; 'cc:addr:python-list': 0.10; 'def': 0.10; 'subject:python': 0.11; '"hello': 0.16; 'disclaimers': 0.16; 'disclaimers,': 0.16; 'from:addr:jpmorgan.com': 0.16; 'received:155.180': 0.16; 'received:159.53': 0.16; 'received:bankone.net': 0.16; 'received:exchad.jpmchase.net': 0.16; 'received:jpmchase.com': 0.16; 'received:jpmchase.net': 0.16; 'received:svr.bankone.net': 0.16; 'securities,': 0.16; 'trace,': 0.16; 'url:disclosures': 0.16; 'url:jpmorgan': 0.16; 'wrote:': 0.17; 'pfxlen:0': 0.17; 'specify': 0.17; 'combination': 0.22; 'trace': 0.22; 'cc:2**0': 0.23; 'received:169.254': 0.24; 'command': 0.24; 'cc:addr:python.org': 0.25; 'header:In-Reply-To:1': 0.25; '---': 0.26; 'skip:# 10': 0.27; 'accuracy': 0.27; 'options': 0.27; 'cat': 0.29; 'received:169': 0.29; "i'm": 0.29; 'url:python': 0.32; 'print': 0.32; 'screen': 0.34; 'subject:?': 0.35; 'there': 0.35; 'url:org': 0.36; 'url:library': 0.36; 'charset:us-ascii': 0.36; 'subject:: ': 0.38; 'url:docs': 0.38; 'information,': 0.63; 'url:email': 0.63; 'legal': 0.65; 'subject': 0.66; 'purchase': 0.67; 'sale': 0.76; 'received:169.254.8': 0.84; 'subject:commands': 0.84; 'world!"': 0.84
X-DKIM OpenDKIM Filter v2.1.3 sz2.jpmchase.com qA9LQLZ2010500
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=jpmorgan.com; s=smtpout; t=1352496381; bh=sVOWqyPFZtaWjd3o0wHYxv7HOgGw/akQTSgi4Apd0TU=; h=From:To:CC:Subject:Date:Message-ID:References:In-Reply-To: Content-Transfer-Encoding:MIME-Version:Content-Type; b=YqPMOdExIF+288bFntq957jO2kzdzUd0BajtD2GyuN0TKpMtXLUS2cw43TT3P1NYg MPdfjLOjiPDEjCBbT7YUiSkJm4GPXvtLsoGi2RArI5seWWdtLibLrH1BYUQEd0Cq9d VkbRtgfi4xqbRFzX2U5qKJbPeQ9KWS7uGLuowl9w=
From "Prasad, Ramit" <ramit.prasad@jpmorgan.com>
To Peng Yu <pengyu.ut@gmail.com>
Subject RE: How to print python commands automatically?
Thread-Topic How to print python commands automatically?
Thread-Index AQHNvgbs07IZYbXoAkK5QJTU6oMiJJfgz0e6gAGD9QD//7D24A==
Date Fri, 9 Nov 2012 21:26:08 +0000
References <dde69612-f2f5-4eed-a6fc-f2a2e8af4f75@v3g2000yqb.googlegroups.com> <603f952f-a1a2-48a3-ab55-bdc7982a1f2a@i7g2000pbf.googlegroups.com> <CABrM6wmoVRKWNaLco4xPFrznDDdbA8xWxNFNA=Q93xjDM9d=xw@mail.gmail.com>
In-Reply-To <CABrM6wmoVRKWNaLco4xPFrznDDdbA8xWxNFNA=Q93xjDM9d=xw@mail.gmail.com>
Accept-Language en-US
Content-Language en-US
X-MS-Has-Attach
X-MS-TNEF-Correlator
x-originating-ip [10.67.79.47]
Content-Transfer-Encoding quoted-printable
MIME-Version 1.0
X-DLP-FWD Yes
Content-Type text/plain; charset="us-ascii"
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 <http://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 <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.3516.1352496389.27098.python-list@python.org> (permalink)
Lines 25
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1352496389 news.xs4all.nl 6895 [2001:888:2000:d::a6]:60015
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:33053

Show key headers only | View raw


Peng Yu wrote:
> 
> > Is this what you want?
> > http://docs.python.org/2/library/trace.html
> 
> I'm not able to get the mixing of the python command screen output on
> stdout. Is there a combination of options for this purpose?
> 
> ~/linux/test/python/man/library/trace$ cat main1.py
> #!/usr/bin/env python
> 
> def f():
>   print "Hello World!"
> 
> f()
> ~/linux/test/python/man/library/trace$ cat main.sh
> #!/usr/bin/env bash
> 
> python -m trace --count -C . main1.py -t
> 
> ~/linux/test/python/man/library/trace$ ./main.sh
> Hello World!
> ~/linux/test/python/man/library/trace$ cat main1.cover
>        #!/usr/bin/env python
> 
>     1: def f():
>     1:   print "Hello World!"
> 
>     1: f()
> 

Try with just --trace?


C:\ramit>python.exe -m trace test.py
C:\ramit\Python27\lib\trace.py: must specify one of --trace, --count, --report, --listfuncs, or --trackcalls

C:\ramit>python -m trace --trace test.py
 --- modulename: test, funcname: <module>
test.py(2): def f():
test.py(5): f()
 --- modulename: test, funcname: f
test.py(3):     print "Hello World!"
Hello World!
 --- modulename: trace, funcname: _unsettrace
trace.py(80):         sys.settrace(None)



~Ramit


This email is confidential and subject to important disclaimers and
conditions including on offers for the purchase or sale of
securities, accuracy and completeness of information, viruses,
confidentiality, legal privilege, and legal entity disclaimers,
available at http://www.jpmorgan.com/pages/disclosures/email.  

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


Thread

How to print python commands automatically? Peng Yu <pengyu.ut@gmail.com> - 2012-11-08 15:12 -0800
  Re: How to print python commands automatically? rusi <rustompmody@gmail.com> - 2012-11-08 18:50 -0800
    Re: How to print python commands automatically? Peng Yu <pengyu.ut@gmail.com> - 2012-11-09 15:03 -0600
    RE: How to print python commands automatically? "Prasad, Ramit" <ramit.prasad@jpmorgan.com> - 2012-11-09 21:26 +0000
    Re: How to print python commands automatically? Peng Yu <pengyu.ut@gmail.com> - 2012-11-09 16:40 -0600
      Re: How to print python commands automatically? rusi <rustompmody@gmail.com> - 2012-11-10 07:16 -0800

csiph-web