Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #32984 > unrolled thread
| Started by | Peng Yu <pengyu.ut@gmail.com> |
|---|---|
| First post | 2012-11-08 15:12 -0800 |
| Last post | 2012-11-10 07:16 -0800 |
| Articles | 6 — 3 participants |
Back to article view | Back to comp.lang.python
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
| From | Peng Yu <pengyu.ut@gmail.com> |
|---|---|
| Date | 2012-11-08 15:12 -0800 |
| Subject | How to print python commands automatically? |
| Message-ID | <dde69612-f2f5-4eed-a6fc-f2a2e8af4f75@v3g2000yqb.googlegroups.com> |
Hi, In bash, set -v will print the command executed. For example, the following screen output shows that the "echo" command is printed automatically. Is there a similar thing in python? ~/linux/test/bash/man/builtin/set/-v$ cat main.sh #!/usr/bin/env bash set -v echo "Hello World!" ~/linux/test/bash/man/builtin/set/-v$ ./main.sh echo "Hello World!" Hello World! Regards, Peng
[toc] | [next] | [standalone]
| From | rusi <rustompmody@gmail.com> |
|---|---|
| Date | 2012-11-08 18:50 -0800 |
| Message-ID | <603f952f-a1a2-48a3-ab55-bdc7982a1f2a@i7g2000pbf.googlegroups.com> |
| In reply to | #32984 |
On Nov 9, 4:12 am, Peng Yu <pengyu...@gmail.com> wrote: > Hi, > > In bash, set -v will print the command executed. For example, the > following screen output shows that the "echo" command is printed > automatically. Is there a similar thing in python? > > ~/linux/test/bash/man/builtin/set/-v$ cat main.sh > #!/usr/bin/env bash > > set -v > echo "Hello World!" > ~/linux/test/bash/man/builtin/set/-v$ ./main.sh > echo "Hello World!" > Hello World! > > Regards, > Peng Is this what you want? http://docs.python.org/2/library/trace.html
[toc] | [prev] | [next] | [standalone]
| From | Peng Yu <pengyu.ut@gmail.com> |
|---|---|
| Date | 2012-11-09 15:03 -0600 |
| Message-ID | <mailman.3513.1352495041.27098.python-list@python.org> |
| In reply to | #32992 |
> 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()
--
Regards,
Peng
[toc] | [prev] | [next] | [standalone]
| From | "Prasad, Ramit" <ramit.prasad@jpmorgan.com> |
|---|---|
| Date | 2012-11-09 21:26 +0000 |
| Message-ID | <mailman.3516.1352496389.27098.python-list@python.org> |
| In reply to | #32992 |
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.
[toc] | [prev] | [next] | [standalone]
| From | Peng Yu <pengyu.ut@gmail.com> |
|---|---|
| Date | 2012-11-09 16:40 -0600 |
| Message-ID | <mailman.3524.1352500832.27098.python-list@python.org> |
| In reply to | #32992 |
> 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
[toc] | [prev] | [next] | [standalone]
| From | rusi <rustompmody@gmail.com> |
|---|---|
| Date | 2012-11-10 07:16 -0800 |
| Message-ID | <b1447d7f-6182-4045-9cb8-4fa0a1cc5a18@6g2000pbh.googlegroups.com> |
| In reply to | #33062 |
On Nov 9, 10:41 pm, Peng Yu <pengyu...@gmail.com> wrote: > I have to explicitly specify the modules I want to ignore. Is there a > way to ignore all the modules by default? Is this your problem? http://bugs.python.org/issue10685
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.python
csiph-web