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


Groups > comp.lang.python > #33062

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!xlned.com!feeder1.xlned.com!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <pengyu.ut@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.001
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'received:209.85.223': 0.03; 'explicitly': 0.04; 'test,': 0.05; 'subject:How': 0.09; 'subject:skip:a 10': 0.09; 'cc:addr:python-list': 0.10; 'def': 0.10; 'subject:python': 0.11; 'ignore': 0.13; '"hello': 0.16; 'trace,': 0.16; 'specify': 0.17; 'import': 0.21; 'trace': 0.22; 'cc:2**0': 0.23; 'to:2**1': 0.23; 'cc:addr:python.org': 0.25; 'header:In-Reply-To:1': 0.25; '---': 0.26; 'message- id:@mail.gmail.com': 0.27; 'print': 0.32; 'received:google.com': 0.34; 'subject:?': 0.35; 'received:209.85': 0.35; 'there': 0.35; 'modules': 0.36; 'test': 0.36; 'received:209': 0.37; 'subject:: ': 0.38; 'header:Received:5': 0.40; 'subject:commands': 0.84; 'world!"': 0.84
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=N1JOdwOZC5eRqEhz59My5nzvLVoqQhHnHVMDIwq4HzA=; b=muee+1pKasgQ9k2Ox/ObvD+hqNHLF4G4TnFu0zK06cMBTHRzSzvTbI9/nBO4MgYvb1 C9qaRWod6xnaSZ8tPIUnf2aB7kyM7eV9AE9NTocsPe/9FaMrOzW28osGforIf1EQINUp //L7c7J06VCSvM2xbNxzFv1PK/u8mP9sbgVi1NUrz7D7qwu2HUfVmCfM/0g63iBX6lwF f/9pUrFWLNUoMVo20FCL0OVxxhui4O3EvIga7TKz2eu2U0JQaZdukelkUzWINbAFDmq2 Q9ovPvcqp/RzCt0HoIIUs4gbg8G5oIPHbzasQRtZcLIPIx4iprrkgug2Ltpo8SzXtYCU 2k+g==
MIME-Version 1.0
In-Reply-To <5B80DD153D7D744689F57F4FB69AF4741678D3A6@SCACMX008.exchad.jpmchase.net>
References <dde69612-f2f5-4eed-a6fc-f2a2e8af4f75@v3g2000yqb.googlegroups.com> <603f952f-a1a2-48a3-ab55-bdc7982a1f2a@i7g2000pbf.googlegroups.com> <CABrM6wmoVRKWNaLco4xPFrznDDdbA8xWxNFNA=Q93xjDM9d=xw@mail.gmail.com> <5B80DD153D7D744689F57F4FB69AF4741678D3A6@SCACMX008.exchad.jpmchase.net>
Date Fri, 9 Nov 2012 16:40:29 -0600
Subject Re: How to print python commands automatically?
From Peng Yu <pengyu.ut@gmail.com>
To "Prasad, Ramit" <ramit.prasad@jpmorgan.com>
Content-Type text/plain; charset=ISO-8859-1
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.3524.1352500832.27098.python-list@python.org> (permalink)
Lines 54
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1352500832 news.xs4all.nl 6954 [2001:888:2000:d::a6]:35726
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:33062

Show key headers only | View raw


> 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)

I have to explicitly specify the modules I want to ignore. Is there a
way to ignore all the modules by default?

~/linux/test/python/man/library/trace/import$ cat.sh main.py main.sh test.py
==> main.py <==
#!/usr/bin/env python

import test

test.test()


==> main.sh <==
#!/usr/bin/env bash

python -m trace --trace main.py


==> test.py <==
def test1():
  print "Hello World!"

def test():
  test1()

~/linux/test/python/man/library/trace/import$ python -m trace --trace
--ignore-module=test main.py
 --- modulename: main, funcname: <module>
main.py(3): import test
main.py(5): test.test()
Hello World!
 --- modulename: trace, funcname: _unsettrace
trace.py(80):         sys.settrace(None)


-- 
Regards,
Peng

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