Python .elc and /etc/magic
François Pinard
pinard at iro.umontreal.ca
Tue Nov 13 16:38:53 EST 2001
Hi, friends. I notice that the standard `file' program fails to recognise
that `.pyc' files are compiled Python codes, and is not always clever even
for `.py' files, witness the third line below:
/usr/local/lib/python/Local/commun.py: a python script text
/usr/local/lib/python/Local/commun.pyc: data
/usr/local/lib/python/Local/defs.py: ISO-8859 Java program text
/usr/local/lib/python/Local/defs.pyc: data
/usr/local/lib/python/Local/machines.py: a python script text
/usr/local/lib/python/Local/machines.pyc: data
/usr/local/lib/python/Local/make.py: a python script text
/usr/local/lib/python/Local/make.pyc: data
Is there any standard `/etc/magic' entries that would work better for Python?
Here is the Python relevant code in the copy from Linux SuSE 7.2.
# often the module starts with a multiline string
0 string """ a python script text
# MAGIC as specified in Python/import.c (1.5.2/1.6)
# 20121 ( YEAR - 1995 ) + MONTH + DAY (little endian followed by "\r\n"
0 belong 0x994e0d0a python compiled
It probably matters to know that Python 2.0 is the default on this system.
And even, if one knows the proper incantations, how do we proceed then
for having that `/etc/magic' file more universally modified?
--
François Pinard http://www.iro.umontreal.ca/~pinard
More information about the Python-list
mailing list