Created a "file" like command in python (see man 4 magic) and face a showstoper bug
thomas.mangin at free.fr
Mon Jun 3 21:13:50 CEST 2002
I wrote some code perform "file" like operation and I am facing a
the files can be found at : ftp://www.slhan.org/source/circle/
It produce the same output that "file":
# ./magic.py core
core: ELF 32-bit LSB core file of 'vi' (signal 11), Intel 80386,
version 1 (SYSV)
# ./magic.py jpg_good.jpg
jpg_good.jpg: JPEG image data, JFIF standard 1.01, resolution (DPI),
50 x 50
# ./magic.py jpg_bad.jpg
jpg_bad.jpg: JPEG image data, EXIF standard %d.73, 10752 x 2048
Note the %d !
The code causing problem is :
mime = mime % replace
In both case mime is containing the string "%d." and replace is in
both case of type int and valued 1 and 0.
Any idea ?
More information about the Python-list