1
0

don't use bare except

use "except Exception", or if really needed explicitly "except BaseException"
This commit is contained in:
SomberNight
2023-04-23 01:33:12 +00:00
parent 6848b8f375
commit 312f2641e7
57 changed files with 118 additions and 118 deletions

View File

@@ -104,7 +104,7 @@ class ExchangeBase(Logger):
try:
with open(filename, 'r', encoding='utf-8') as f:
h = json.loads(f.read())
except:
except Exception:
return None
if not h: # e.g. empty dict
return None
@@ -469,7 +469,7 @@ def get_exchanges_and_currencies():
try:
with open(path, 'r', encoding='utf-8') as f:
return json.loads(f.read())
except:
except Exception:
pass
# or if not present, generate it now.
print("cannot find currencies.json. will regenerate it now.")
@@ -483,7 +483,7 @@ def get_exchanges_and_currencies():
try:
d[name] = await exchange.get_currencies()
print(name, "ok")
except:
except Exception:
print(name, "error")
async def query_all_exchanges_for_their_ccys_over_network():