Created a "file" like command in python (see man 4 magic) and face a showstoper bug
Thomas Mangin
thomas.mangin at free.fr
Mon Jun 3 15:13:50 EDT 2002
Hi,
I wrote some code perform "file" like operation and I am facing a
nasty bug.
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 :
if replace:
try:
mime = mime % replace
except:
pass
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 ?
Thomas Mangin
More information about the Python-list
mailing list