R. David Murray <rdmur...@bitdance.com> added the comment:

Kovid: so essentially what you are saying is that the windows platform is 
broken with respect to MIME types and with respect to its security model.  Why 
am I not surprised? :)

You would have the same problem if software installation altered the 
/etc/mimetypes file on a unix box and created weird entries.  Perhaps unix 
programmers are just better disciplined?

Reading the registry first and having the built in settings override would IMO 
defeat the purpose of reading the values from the registry: those are 
(theoretically!!) the settings the user chose to change.

However, working around it in your program should be simple: just call 
mimetypes.init with an empty file list.  The windows registry is only read if 
the files parameter is None.  This will also give you consistent behavior on 
windows and unix: only the default mime types in the mimetypes module will be 
used.  If, on the other hand, you want to retain the Unix behavior, you can 
pass init mimetypes.knownfiles instead of the empty list.

(By they way, thanks very much for calibre, I have used the CLI tools to great 
benefit, and love the fact that the CLI is the basis of the program.)

----------
nosy: +r.david.murray
resolution:  -> invalid
stage:  -> committed/rejected
status: open -> closed
type:  -> behavior

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue10551>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to