Skip to content

Commit

Permalink
handle missing advances file
Browse files Browse the repository at this point in the history
  • Loading branch information
countvajhula committed Mar 15, 2024
1 parent dbdc150 commit 4cf540e
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions oldabe/money_in.py
Original file line number Diff line number Diff line change
Expand Up @@ -419,15 +419,18 @@ def read_debts():
def read_advances():
advances_file = os.path.join(ABE_ROOT, ADVANCES_FILE)
advances = defaultdict(list)
with open(advances_file) as f:
for (
email,
amount,
payment_file,
commit_hash,
created_at,
) in csv.reader(f):
advances[email].append(Advance(email, amount, payment_file, commit_hash, created_at))
try:
with open(advances_file) as f:
for (
email,
amount,
payment_file,
commit_hash,
created_at,
) in csv.reader(f):
advances[email].append(Advance(email, amount, payment_file, commit_hash, created_at))
except FileNotFoundError:
pass

return advances

Expand Down

0 comments on commit 4cf540e

Please sign in to comment.