diff options
author | Florian Pritz <bluewind@xinu.at> | 2017-05-03 15:06:48 +0200 |
---|---|---|
committer | Florian Pritz <bluewind@xinu.at> | 2017-05-03 15:06:48 +0200 |
commit | a94fa00eb6475d548024c716defb73d3c5abfa29 (patch) | |
tree | 5a9a41e285807c2520dc30d37faeddc54409e27b | |
parent | e195665788a6eebec78007602c13198ec6ce3458 (diff) |
Fix python2 compatability of config parser
FileNotFoundError does not exist in python2. Also it returns an IOError
instead of OSError and IOError is an alias for OSError in python3 so
just use IOError here so it works for both versions.
Signed-off-by: Florian Pritz <bluewind@xinu.at>
-rwxr-xr-x | fb.py | 5 |
1 files changed, 1 insertions, 4 deletions
@@ -397,14 +397,11 @@ class ConfigParser: def _parse(self, file, ignoreMissing=False): try: fh = open(file) - except OSError as e: + except IOError as e: if ignoreMissing: if e.errno == errno.ENOENT: return raise - except FileNotFoundError: - if ignoreMissing: - return with fh: for line in fh: |