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


Groups > comp.lang.python > #33062

Re: How to print python commands automatically?

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 2012-11-09 16:40 -0600
Subject Re: How to print python commands automatically?
From Peng Yu <pengyu.ut@gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.3524.1352500832.27098.python-list@python.org> (permalink)

Show all headers | 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