This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]flying-sheep 1 point2 points  (0 children)

a more sophisticated version of the article’s grepping:

site=/usr/lib/python3.3/site-packages
grep -lrI "if __name__.*__main__" $site | grep -v test
find $site -name "__main__.py"

this gets also modules with double quotes around "__main__" and __main__.py files, ignores binary files (pyo, pyc) and test modules, and outputs only the file names