Browse Source

fix #58; ValueError raised when reading 'cm_servers.json'

pull/60/merge
Rossen Georgiev 9 years ago
parent
commit
ad80a2fe91
  1. 8
      steam/client/__init__.py

8
steam/client/__init__.py

@ -101,13 +101,15 @@ class SteamClient(CMClient, BuiltinBase):
if not os.path.isfile(filepath): return if not os.path.isfile(filepath): return
self._LOG.debug("Reading CM servers from %s" % repr(filepath)) self._LOG.debug("Reading CM servers from %s" % repr(filepath))
try: try:
with open(filepath, 'r') as f: with open(filepath, 'r') as f:
data = json.load(f) data = json.load(f)
except ValueError:
self._LOG.error("Failed parsing %s", repr(filepath))
except IOError as e: except IOError as e:
self._LOG.error("load %s: %s" % (repr(filepath), str(e))) self._LOG.error("Failed reading %s (%s)", repr(filepath), str(e))
return else:
self.cm_servers.clear() self.cm_servers.clear()
self.cm_servers.merge_list(data['servers']) self.cm_servers.merge_list(data['servers'])
self._cm_servers_timestamp = int(data['timestamp']) self._cm_servers_timestamp = int(data['timestamp'])

Loading…
Cancel
Save