Do you, like me, use the powerful print
function to debug your Python code? Do you, like me, sometimes forget to remove lines with print
and ship this out to less development-like environments? Do you, like I did, need a way to check for forgotten print statements?
I've written a dumb-simple script that scans through a directory for print statements. It uses a recursive grep command so this won't work for you hopeless Windows people :)
Download it and put it in your ~/bin
(you might want to read it through) then all you have to do is to run it against a directory where there are lots of .py
files:
$ find_print_statements.py ~/dev/mypythonmodule
If it doesn't work perhaps you can patch it and let me know. This might not be for the faint-hearted. There might be serious security concerns unless you have full control over your users and su account. I take no responsibility if this script rm -fr /
your hd.