[Mailman-Users] upgrading results in duplicate Python files ?

Barry A. Warsaw barry at digicool.com
Tue Jan 2 23:39:51 CET 2001

>>>>> "MD" == Michael Dunston <mdunston at music.vt.edu> writes:

    MD> I recently upgraded both Python (1.52 -> 2.0) and Mailman
    MD> (2.0b5 -> 2.0) and now appear to have duplicate python files
    MD> in the 'Mailman' directory.  (Mac OSXS 1.2)

    MD> ex: aliases.py
    |     aliases.pyc
    |     Bouncer.py
    |     Bouncer.pyc
    |     etc.

    MD> Does anyone know what the '.pyc' files are and if it is safe
    MD> to simply remove them?  THanks for any suggestions.

Sorry if someone else has already answered this (my email is still in
a pitiful state).

Short answer: leave them alone, they're normal for Python.

`.pyc' files contain the Python bytecodes compiled from a
corresponding `.py' Python source file.  When Python imports a module,
and it finds the module in a .py file that is newer than the
corresponding .pyc file (or if the .pyc file doesn't exist yet), it
byte-compiles the code, and caches the bytecodes in the .pyc file.
That way, subsequent imports of that module are much faster -- they
don't have to run through the compiler.  All this happens
automatically so you don't have to worry about it.

Removing them won't help you because Python will just regenerate

Little known fact 1: .pyc files are actually Python marshals of code
objects, plus 8 bytes of leading magic (version numbers, magic
numbers, etc.).

Little known fact 2: There are also .pyo files which are optimized
bytecode caches, generated when Python is run with the -O option.

ain't-guido-clever?-ly y'rs,

More information about the Mailman-Users mailing list