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

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


On Jan 19, 12:13 pm, dsblizz... at gmail.com 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 foo.py that is in the same
directory, then foo.py 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 foo.py that
is not in sys.path.

HTH,
John




More information about the Python-list mailing list