byte code generated under linux ==> bad magic number under windows

Delaney, Timothy C (Timothy) tdelaney at avaya.com
Mon Dec 6 17:16:56 EST 2004


Philippe C. Martin wrote:

> I understand from my reading that a .pyc generated by python anywhere
> should run anywhere else - is that true ?
> 
> If I generate 'compile.all' a pyc with python 2.3.3 under Linux, I
                                                ^^^^^
> get a 'bad magic number' trying to execute it under windows (2.4).
                                                               ^^^
> are the pyc plateform dependant ? and if so must I generate one
> version for each version of Linux, windows ...... ?

.pyc files are not platform dependent, but they are *version* dependent
- specifically, major version (i.e. 2.3, 2.4).

Between major versions, the bytecode can change. There were in fact some
significant changes between 2.3 and 2.4.

Tim Delaney



More information about the Python-list mailing list