From 6e267036c041adc818dbc524acfe9bb403941a9e Mon Sep 17 00:00:00 2001 From: Yichao Zhou Date: Sun, 7 Feb 2021 02:20:30 -0500 Subject: [PATCH] Skip paypal transactions that do not contain date entries --- beancount_import/source/paypal.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/beancount_import/source/paypal.py b/beancount_import/source/paypal.py index 3485cb55..4bcdbe5a 100644 --- a/beancount_import/source/paypal.py +++ b/beancount_import/source/paypal.py @@ -619,6 +619,10 @@ def prepare(self, journal: JournalEditor, results: SourceResults): self.log_status('paypal: processing %s' % (path, )) with open(path, 'r', encoding='utf-8', newline='\n') as f: txn = json.load(f) + # some old unfinished transactions do not contain "date" entries. + # skip them to avoid validation errors. + if "date" not in txn: + continue jsonschema.validate(txn, transaction_schema) import_result = self._make_import_result( txn_id=txn_id, data=txn, json_path=path)