leftover pyc files

Terry Reedy tjreedy at udel.edu
Fri Nov 4 16:01:14 EDT 2011


For those not aware, the compiled file caching and import system was 
changed for 3.2. Given test.py, the compiled file is no longer test.pyc, 
in the same directory, but (for cpython32) 
__pycache__/test.cpython-32.pyc. Given the statement 'import test', the 
__pycache__ directory is only searched (for the name given above) after 
finding test.py. So if 'test.py' is deleted or renamed to 'mytest.py', 
an unchanged 'import test' will *fail* instead of importing the obsolete 
.pyc file. So there is no longer a functional reason to delete such 
obsolete files. However, the OP is stuck with 2.5.

-- 
Terry Jan Reedy




More information about the Python-list mailing list