silence ENOTDIR when loading config file

This commit is contained in:
David Lord 2018-01-05 07:40:51 -08:00
parent 26f413e1e5
commit 06f96df67e
No known key found for this signature in database
GPG key ID: 7A1C87E3F5BC42A8
2 changed files with 10 additions and 2 deletions

View file

@ -129,7 +129,9 @@ class Config(dict):
with open(filename, mode='rb') as config_file:
exec(compile(config_file.read(), filename, 'exec'), d.__dict__)
except IOError as e:
if silent and e.errno in (errno.ENOENT, errno.EISDIR):
if silent and e.errno in (
errno.ENOENT, errno.EISDIR, errno.ENOTDIR
):
return False
e.strerror = 'Unable to load configuration file (%s)' % e.strerror
raise