[Python-Dev] Identifying magic prefix on Python files?

Eric S. Raymond esr@thyrsus.com
Sun, 4 Feb 2001 17:16:25 -0500


Ka-Ping Yee <ping@lfw.org>:
> I don't understand, Eric.  Why won't the existing magic number work?

My error.  I looked at a couple of .pyc files, but thought the two-byte 
magic was actual code instead.  Turns out the real problem is that Linux 
file(1) doesn't recognize this prefix.
 
> I tried the following and it works fine:
> 
> 0	string		\x99N\x0d	Python 1.5.2 compiled bytecode data
> 0	string		\x87\xc6\x0d	Python 2.0 compiled bytecode data

This doesn't work when I append it to /etc/magic.  I'm investigating.
-- 
		<a href="http://www.tuxedo.org/~esr/">Eric S. Raymond</a>

Never trust a man who praises compassion while pointing a gun at you.