This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: mimetypes read_windows_registry should tolerate permissions errors
Type: behavior Stage: resolved
Components: Library (Lib), Windows Versions: Python 3.2, Python 2.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: brian.curtin Nosy List: aclover, brian.curtin, tim.golden
Priority: normal Keywords: patch

Created on 2010-10-21 00:44 by aclover, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
mimetypes-patch-3.2a3.patch aclover, 2010-10-21 00:44 Ignore permissions errors, patch for mimetypes in py3k branch
mimetypes-patch-2.7.patch aclover, 2010-10-21 00:45 Ignore permissions errors, patch for mimetypes in release27-maint branch
Messages (4)
msg119252 - (view) Author: And Clover (aclover) * Date: 2010-10-21 00:44
It is relatively common to have keys in the HKEY_CLASSES_ROOT MIME database that are not readable to all users, typically written by third-party applications. (My WinXP test box has a dozen, for apps like Flash, Silverlight and Java.)

Currently, initialising mimetypes causes Python to try to read them all, and if the user running Python doesn't have permission to read a key (in particular, if the user is a low-privilege daemon user such as IUSR_...), the script that caused mimetypes to be called will error out.

This patch moves the try-block around the call to OpenKey as well as QueryValueEx, allowing the key to be skipped if unreadable.
msg119253 - (view) Author: And Clover (aclover) * Date: 2010-10-21 00:45
(same against 2.7 branch)
msg119267 - (view) Author: Tim Golden (tim.golden) * (Python committer) Date: 2010-10-21 07:45
I've only read the patch and not applied it, yet. But in principle I'm 
+1 on this. If Brian doesn't get there first, I'll try to apply later.
msg119306 - (view) Author: Brian Curtin (brian.curtin) * (Python committer) Date: 2010-10-21 14:50
Fixed in py3k (r85774, minor correction in r85775), and release27-maint (r85776).

Thanks for the patches!
History
Date User Action Args
2022-04-11 14:57:07adminsetgithub: 54371
2010-10-21 14:50:06brian.curtinsetstatus: open -> closed
type: enhancement -> behavior
messages: + msg119306

assignee: brian.curtin
resolution: fixed
stage: resolved
2010-10-21 07:45:48tim.goldensetmessages: + msg119267
2010-10-21 04:34:48ned.deilysetnosy: + tim.golden, brian.curtin
components: + Windows
2010-10-21 00:45:50acloversetfiles: + mimetypes-patch-2.7.patch

messages: + msg119253
2010-10-21 00:44:35aclovercreate