En Wed, 05 May 2010 10:34:34 -0300, gelonida <gelon...@gmail.com> escribió:

I'd like to know whether the byte code of two .pyc files is identical.

I thought, I could just compare the md5sums of thw .pyc files.
However this does not work.

It seems, that .pyc ontains the time stamp of the source file.
the .pyc file changes its contents when I don't change the file's
contents but just
save it again.

Yes, that's what happens.
First 4 bytes in a .pyc file contain a "magic" number identifying the Python version used to create it. Next 4 bytes contain the timestamp of the source file.

Just ignore the first 8 bytes when computing the checksum:

tail -c +8 tst.pyc | md5sum

(untested)

--
Gabriel Genellina

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to