How to use *.py modules instead of *.pyc?

John Machin sjmachin at
Mon Jan 19 02:23:33 CET 2009

On Jan 19, 12:13 pm, dsblizz... at wrote:
> How to use *.py modules instead of *.pyc or automatically recompile
> all modules each time I change *.py files?

You don't need to do anything special. If, when you import foo,
foo.pyc is outdated by changes to the that is in the same
directory, then will be compiled to a new foo.pyc -- otherwise
compilation is unnecessary and the existing foo.pyc will be used.

If you think you have a problem, it could be caused by foo.pyc being
in a directory that is in sys.path but you are editing a that
is not in sys.path.


More information about the Python-list mailing list