Florian Bruhin <python....@the-compiler.org> added the comment:
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. ---------- nosy: +The Compiler _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue38656> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com