Cross compile generation of .pyc from .py files...

Terry Reedy tjreedy at udel.edu
Wed Mar 1 14:42:52 EST 2006


<venkatbo at yahoo.com> wrote in message 
news:1141234081.046271.326160 at i39g2000cwa.googlegroups.com...
> ppc system.  The "...has bad magic..."  appears to indicate that

The format of .pyc files, which are generated for greater speed of repeat 
runs, is considered an internal implementation detail subject to change.
The exact details are generally specific to each x,y version.  (For 
instance, byte codes are occasionally added.)  So each version generally 
has a version-specific magic number and will only run .pyc files with the 
same magic number.  If you get 'bad magic' from the interpreter, then you 
have a mismatch.

If you are shipping .py files, there is no need to also ship .pyc files. 
Let them be generated as needed or run compileall at installation.

Terry Jan Reedy






More information about the Python-list mailing list