redstreet/beancount_reds_importers

Quick guidance on AttributeError: 'NoneType' object has no attribute 'date' error msg

kaiwei opened this issue · 2 comments

Hi all, I am (very) new to python and trying my best to get the importers up and running (Thanks Red!) but I am encountering some error messages which I unfortunately cannot understand. Some pointers or tips on where I went wrong will be very much appreciated!

From my rough understanding, it seems to have something to do with dates - but I do think I've set the date format correctly in the CONFIG file, and also double-checked that the date format in CSV aligns - it's DD-MM-YYYY in the raw csv file.

ERROR MESSAGE:

**** /mnt/tank/[XXX]/.local/lib/python3.10/site-packages/beancount_reds_importers/scb/AccountTransactions230115231624359204879.csv
Importer: beancount_reds_importers.scb.Importer
Account: Assets:Bank:SCB

ERROR:root:Importer beancount_reds_importers.scb.Importer.extract() raised an unexpected error: 'NoneType' object has no attribute 'date'
Traceback (most recent call last):
File "/mnt/tank/[XXX]/.local/lib/python3.10/site-packages/beancount/ingest/extract.py", line 182, in extract
new_entries = extract_from_file(
File "/mnt/tank/[XXX]/.local/lib/python3.10/site-packages/beancount/ingest/extract.py", line 67, in extract_from_file
new_entries = importer.extract(file, **kwargs)
File "/mnt/tank/[XXX]/.local/lib/python3.10/site-packages/beancount_reds_importers/libtransactionbuilder/banking.py", line 107, in extract
entry = data.Transaction(metadata, ot.date.date(), self.FLAG,
AttributeError: 'NoneType' object has no attribute 'date'
;; -- mode: beancount --

From MY.CONFIG

from beancount_reds_importers.libreader import csvreader
from beancount_reds_importers.libtransactionbuilder import banking

class Importer(banking.Importer, csvreader.Importer):
def custom_init(self):
self.max_rounding_error = 0.04
self.date_format = '%d-%m-%Y'

Hi there,
This might be difficult to get through without some familiarity with debugging python, honestly. Try inserting this line before where it errors and examine the value of ot and ot.date

import pdb; pdb.set_trace()

Going to close this ticket. Feel free to reopen if you have other questions.