Author The Compiler
Recipients The Compiler, ammar2, toonn, xtreak
Date 2019-11-18.09:47:12
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1574070433.01.0.843005644157.issue38656@roundup.psfhosted.org>
In-reply-to
Content
I'm seeing the same in ranger and I'm currently trying to debug this - I'm still
not quite sure what I'm seeing as there seem to be various issues/weirdnesses
which overlap each other.

This strikes me as odd:

>>> import mimetypes
>>> mimetypes.guess_type('E01.mkv')
('video/x-matroska', None)
>>> mimetypes.types_map['.mkv']
'video/x-matroska'

>>> mt = mimetypes.MimeTypes()
>>> mt.guess_type('E01.mkv')
(None, None)
>>> mt.types_map
({'.rtf': 'application/rtf', [redacted for brevity]}, {'.js': 'application/javascript', [redacted for brevity]})
>>> mt.types_map[0]['.mkv']
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
KeyError: '.mkv'
>>> mt.types_map[1]['.mkv']
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
KeyError: '.mkv'

The Python documentation claims: "This class represents a MIME-types database.
By default, it provides access to the same database as the rest of this module.
The initial database is a copy of that provided by the module" - yet that
apparently isn't the case.

I see this with both Python 3.7.5 and 3.8.0, but with 3.6.9 I get the correct
output for both module- and class-level access.
History
Date User Action Args
2019-11-18 09:47:13The Compilersetrecipients: + The Compiler, ammar2, xtreak, toonn
2019-11-18 09:47:13The Compilersetmessageid: <1574070433.01.0.843005644157.issue38656@roundup.psfhosted.org>
2019-11-18 09:47:12The Compilerlinkissue38656 messages
2019-11-18 09:47:12The Compilercreate