Replace JSONDecodeError by ValueError (Python 3.4 compatibility)

Fix #847
This commit is contained in:
Julien Duponchelle committed 2016-12-21 09:45:24 +01:00
1 parent 8c61ef18ba
commit e53db1ed81
4 files changed
+4 -4

No files matched your search

+1 -1
View File
@@ -127,7 +127,7 @@ class Controller:
self.save()
with open(self._config_file) as f:
data = json.load(f)
except (OSError, json.decoder.JSONDecodeError) as e:
except (OSError, ValueError) as e:
log.critical("Cannot load %s: %s", self._config_file, str(e))
return
@@ -234,7 +234,7 @@ class VirtualBoxGNS3VM(BaseGNS3VM):
if resp:
try:
json_data = yield from resp.json()
except json.decoder.JSONDecodeError:
except ValueError:
pass
resp.close()
+1 -1
View File
@@ -112,7 +112,7 @@ def load_topology(path):
try:
with open(path, encoding="utf-8") as f:
topo = json.load(f)
except (OSError, UnicodeDecodeError, json.decoder.JSONDecodeError) as e:
except (OSError, UnicodeDecodeError, ValueError) as e:
raise aiohttp.web.HTTPConflict(text="Could not load topology {}: {}".format(path, str(e)))
if "revision" not in topo or topo["revision"] < 5:
# If it's an old GNS3 file we need to convert it