 <p>This is a bug in <code>mimetypes</code>, triggered by bad data in the registry. (<code>рєфшю/AMR</code> is not at all a valid MIME media type.)</p> <p><code>ctype</code> is a registry key name returned by <code>_winreg.EnumKey</code>, which <code>mimetypes</code> is expecting to be a Unicode string, but it isn't. Unlike <code>_winreg.QueryValueEx</code>, <code>EnumKey</code> returns a byte string (direct from the ANSI version of the Windows API; <code>_winreg</code> in Python 2 doesn't use the Unicode interfaces even though it returns Unicode strings, so it'll never read non-ANSI characters correctly).</p> <p>So the attempt to <code>.encode</code> it fails with a Unicode​<strong>Decode</strong>​Error trying to get a Unicode string before encoding it back to ASCII!</p> <pre><code>try: ctype = ctype.encode(default_encoding) # omit in 3.x! except UnicodeEncodeError: pass </code></pre> <p>These lines in <code>mimetypes</code> should simply be removed.</p> <p>ETA: <a href="http://bugs.python.org/issue10490">added to bug tracker</a>.</p>