Author Michał Szymaniak
Recipients Michał Szymaniak
Date 2019-11-03.12:33:21
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1572784402.07.0.839086408394.issue38672@roundup.psfhosted.org>
In-reply-to
Content
When user lacks rights to read on of the mimetypes.knownfiles, mimetypes init() will throw PermissionError and library becomes unusable.

Reproduction steps:
# mkdir -p /etc/httpd/conf/
# touch /etc/httpd/conf/mime.types
# chmod a-r /etc/httpd/conf/mime.types
$ python
>>> import mimetypes
>>> mimetypes.init()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python3.7/mimetypes.py", line 355, in init
    db.read(file)
  File "/usr/lib/python3.7/mimetypes.py", line 204, in read
    with open(filename, encoding='utf-8') as fp:
PermissionError: [Errno 13] Permission denied: '/etc/httpd/conf/mime.types'
History
Date User Action Args
2019-11-03 12:33:22Michał Szymaniaksetrecipients: + Michał Szymaniak
2019-11-03 12:33:22Michał Szymaniaksetmessageid: <1572784402.07.0.839086408394.issue38672@roundup.psfhosted.org>
2019-11-03 12:33:21Michał Szymaniaklinkissue38672 messages
2019-11-03 12:33:21Michał Szymaniakcreate