Skip to content

Commit

Permalink
check if path exists first
Browse files Browse the repository at this point in the history
  • Loading branch information
enarjord committed Nov 11, 2024
1 parent a140fb8 commit 8db46dd
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/passivbot.py
Original file line number Diff line number Diff line change
Expand Up @@ -2150,15 +2150,15 @@ def refresh_approved_ignored_coins_lists(self):
if isinstance(path, list) and len(path) == 1 and isinstance(path[0], str):
path = path[0]
if isinstance(path, str):
if self.coin_to_symbol(path):
self.add_to_coins_lists({"long": [path], "short": [path]}, k_coins)
elif os.path.exists(path):
if os.path.exists(path):
try:
content = read_external_coins_lists(path)
if content:
self.add_to_coins_lists(content, k_coins)
except Exception as e:
logging.error(f"Failed to read contents of {path} {e}")
elif self.coin_to_symbol(path):
self.add_to_coins_lists({"long": [path], "short": [path]}, k_coins)
else:
logging.error(
f"error with refresh_approved_ignored_coins_lists: failed to load {path} {k_coins}"
Expand Down

0 comments on commit 8db46dd

Please sign in to comment.