Terry J. Reedy <tjre...@udel.edu> added the comment:
An exception report is a failure to finish but not a crash as meant here. The current code requires all known files and any file explicitly passes to be readable. The proposed simple change would make it OK if none of them are. But is this really OK? Is it really OK if known files are not readable? Should they not be readable by all? Removing the isfile call would allow directories to be passed through to db.readfp. This might not be a good idea. We would definitely have to think about what errors might be raised on different systems. I think the try-except should be in init rather than db.read. The latter can be called directly and I think a user explicitly passing an filename should be notified. This comment actually also applies to files passed to init. [Sidenote: the doc says that MimeTypes "provides an interface similar to the one of the mimetypes module." The mimetypes.db used by mimetypes functions *is* a MimeTypes instance and the user can call db methods anything after init().] Overall, I am not convinced that the current behavior is a bug, in which case this is an 'enhancement' request that changes the current API. I am not at all a mimetypes expert, so I nosied a couple of email people who have worked on the module and should know more. ---------- nosy: +maxking, r.david.murray, terry.reedy title: Crash on mimetypes.init() if there is no access to one of knownfiles -> mimetypes.init() fails if no access to one of known files _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue38672> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com