How to print python commands automatically?
Peng Yu
pengyu.ut at gmail.com
Fri Nov 9 17:40:29 EST 2012
> 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
More information about the Python-list
mailing list