Generating .pyc/.pyo from a make file
Steve Holden
steve at holdenweb.com
Wed Feb 2 18:39:45 EST 2005
Tim Daneliuk wrote:
> Steve Holden wrote:
>
>> Roland Heiber wrote:
>>
>>> Tim Daneliuk wrote:
>>>
>>>> It does - thanks. One more question: Are pyc and pyo file portable
>>>> across operating systems? I suspect not since I generated a pyo
>>>> on a FreeBSD machine that will not run on a Win32 machine. I was
>>>> under the impression that "compiled" meant optimized byte code that
>>>> was portable across implementations, but it looks to not be the case...
>>>>
>>>
>>> Hi,
>>>
>>> ..pyc's should be, cause it's standard python-bytecode, if you use
>>> massive optimizations it depends not on the os but on the underlying
>>> cpu/architecture ...
>>>
>>> So long, Roland
>>
>>
>>
>> You probably tried to use a bytecode file from *one* version of Python
>> with an interpreter of another version. Python actually checks the
>> first four bytes of the .pyc file for a compatible "magic number"
>> before accepting the file for execution.
>>
>> regards
>> Steve
>
>
> Aha! Exactly ... and that makes perfect sense too. D'oh! I guess a
> better
> distribution strategy would be to have the installation program generate
> the pyo
> file at installation time...
>
> Thanks -
>
That's what most sensible distributions do.
regards
Steve
--
Meet the Python developers and your c.l.py favorites March 23-25
Come to PyCon DC 2005 http://www.pycon.org/
Steve Holden http://www.holdenweb.com/
More information about the Python-list
mailing list