leftover pyc files

Steven D'Aprano steve+comp.lang.python at pearwood.info
Fri Nov 4 02:48:35 EDT 2011


On Thu, 03 Nov 2011 17:54:52 +0000, Andrea Crotti wrote:

> All these ideas (shell and git hooks) are nice, but unfortunately - it's
> svn not git
> - it's windows not *nix
> - we have to remove only the ones without the corresponding *py...

Does it matter? The other .pyc files will be recreated when they are next 
needed. Just nuke all the .pyc files and be done with it. Or if you can't 
bear having to wait for Python to compile them as needed, you can force 
compilation by running your test suite (you do have a test suite, don't 
you?) or by using the compileall.py script.

python -m compileall some_directory 

should do the trick.


-- 
Steven



More information about the Python-list mailing list