Use Python 2 ConfigParser, so correct exceptions get raised.

This commit is contained in:
Itamar Turner-Trauring 2020-08-11 16:40:00 -04:00
parent 277298050f
commit 10378541d7

View File

@ -7,10 +7,17 @@ from future.utils import PY2
if PY2:
from builtins import filter, map, zip, ascii, chr, hex, input, next, oct, open, pow, round, super, bytes, dict, list, object, range, str, max, min # noqa: F401
from configparser import SafeConfigParser
if PY2:
# In theory on Python 2 configparser also works, but then code gets the
# wrong exceptions and they don't get handled. So just use native parser
# for now.
from ConfigParser import SafeConfigParser
else:
from configparser import SafeConfigParser
import attr
class UnknownConfigError(Exception):
"""
An unknown config item was found.