In 2.3a1, the API of the mimetypes module seems to have
changed in a backwards-incompatible way:
Python 2.2.2 (#1, Dec 18 2002, 10:36:37)
[GCC 2.95.4 20011002 (Debian prerelease)] on linux2
Type "help", "copyright", "credits" or "license" for
more information.
>>> import mimetypes
>>> type(mimetypes.read_mime_types('/etc/mime.types'))
<type 'dict'>
Python 2.3a1 (#2, Jan 1 2003, 18:44:29)
[GCC 3.2.2 20021212 (Debian prerelease)] on linux2
Type "help", "copyright", "credits" or "license" for
more information.
>>> import mimetypes
>>> type(mimetypes.read_mime_types('/etc/mime.types'))
<type 'tuple'>
>>> type(mimetypes.read_mime_types('/etc/mime.types')[0])
<type 'dict'>
That is, for some reason the result is now inside a
tuple. Obviously this breaks existing code.
The documentation for read_mime_types still states "The
type map is returned as a dictionary...", so I presume
this is a bug, rather than an intentional change.
|