Advanced python tracing

strace python -m trace --trace | grep -v 'write(1,'
Trace python statement execution and syscalls invoked during that simultaneously
Sample Output
echo 'print("Hello world!")' >; strace python -m trace --trace | grep -v 'write(1,'
execve("/usr/bin/python", ["python", "-m", "trace", "--trace", ""], [/* 22 vars */]) = 0
brk(0)                                  = 0x222e000
access("/etc/", F_OK)      = -1 ENOENT (No such file or directory)
mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f364a418000
access("/etc/", R_OK)      = -1 ENOENT (No such file or directory)
open("/etc/", O_RDONLY|O_CLOEXEC) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=81069, ...}) = 0
mmap(NULL, 81069, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f364a404000
close(3)                                = 0
access("/etc/", F_OK)      = -1 ENOENT (No such file or directory)
open("/lib/x86_64-linux-gnu/", O_RDONLY|O_CLOEXEC) = 3
write(1, " --- modulename: helloworld, fun"..., 188 --- modulename: helloworld, funcname: <module> print("Hello world!")
Hello world!
 --- modulename: trace, funcname: _unsettrace         sys.settrace(None)
) = 188
exit_group(0)                           = ?
+++ exited with 0 +++

By: roolebo
2016-05-27 21:01:01

What Others Think

Command line efu is really a digital mentor for me as it always helps me to produce a command line code. One should read essay writing service reviews before help in essays. I also learn to develop a code in python programming language from this forum because the members and technical teams are so responsive.
LawrenceBartell · 44 weeks and 1 day ago
I have been looking for this information for a long time, I was very surprised when I found it here. jiofi.local.html
malkovich · 30 weeks and 6 days ago
Houston is a large metropolis in Texas, extending to Galveston Bay. It’s closely linked with the Space Center Houston, the coastal visitor center at NASA’s astronaut training and flight control complex. MaxRemind top rank medical billing company of USA offers medical billing services in Houston, TX, medical credentialing services and home health agency software in Houston.
stevematt · 5 weeks and 2 days ago

What do you think?

Any thoughts on this command? Does it work on your machine? Can you do the same thing with only 14 characters?

You must be signed in to comment.

What's this? is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.

Share Your Commands

Stay in the loop…

Follow the Tweets.

Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.


Subscribe to the feeds.

Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):

Subscribe to the feed for: