siddhantgoel / beancount-ing

Beancount Importers for ING (Germany) CSV Exports
MIT License
19 stars 9 forks source link

User name restricted to two words #70

Closed thesoundhead closed 3 years ago

thesoundhead commented 3 years ago

There seems to be a bug with user names, that consist of more than two words (first name + last name). See error output below. There should not be any restriction in this regard in order to make the package usable for everyone.

ERROR:root:Importer beancount_ing_diba.ec.ECImporter.extract() raised an unexpected error: too many values to unpack (expected 9)
Traceback (most recent call last):
  File "/Users/USERNAME/.virtualenvs/ENV/lib/python3.8/site-packages/beancount/ingest/extract.py", line 182, in extract
    new_entries = extract_from_file(
  File "/Users/USERNAME/.virtualenvs/ENV/lib/python3.8/site-packages/beancount/ingest/extract.py", line 67, in extract_from_file
    new_entries = importer.extract(file, **kwargs)
  File "/Users/USERNAME/.virtualenvs/ENV/lib/python3.8/site-packages/beancount_ing_diba/ec.py", line 210, in extract
    (
ValueError: too many values to unpack (expected 9)

When the name is reduced to two words (which does not match the name associated with the bank account in my case), the script runs through and gives the following output: ;; -*- mode: beancount -*-

Any chance, you can fix this soon?

Thanks for the great work!

siddhantgoel commented 3 years ago

Hey, could you paste the input line that's causing this exception? Please remove any sensitive info before pasting.

thesoundhead commented 3 years ago

Hey, could you paste the input line that's causing this exception? Please remove any sensitive info before pasting.

Thanks for the quick reply! Sure thing – the input command I used is: bean-extract config.py ~/Downloads/Umsatzanzeige_IBANPlaceHolder_20210217.csv >> test.beancount

siddhantgoel commented 3 years ago

I meant the contents of the file ~/Downloads/Umsatzanzeige_IBANPlaceHolder_20210217.csv, specifically the line in there that raises this exception. Feel free to replace any sensitive info in that file with random values. But this would be super helpful for debugging.

thesoundhead commented 3 years ago

Okay, sorry for the misunderstanding! This is the dummy data:

Umsatzanzeige;Datei erstellt am: 01.01.2021 12:00
;Letztes Update: aktuell

IBAN;DE00 0000 0000 0000 0000 00
Kontoname;Girokonto
Bank;ING
Kunde;Adam Bernhard Christopher Dow
Zeitraum;01.11.2020 - 30.11.2020
Saldo;1.000,00;EUR

Sortierung;Datum absteigend

In der CSV-Datei finden Sie alle bereits gebuchten Umsätze. Die vorgemerkten Umsätze werden nicht aufgenommen, auch wenn sie in Ihrem Internetbanking angezeigt werden.

Buchung;Valuta;Auftraggeber/Empfänger;Buchungstext;Kategorie;Verwendungszweck;Saldo;Währung;Betrag;Währung
30.11.2020;30.11.2020;Auftraggeber1;Buchungstext1;Kategorie1;Verwendungszweck1;1.000,00;EUR;100,00;EUR
25.11.2020;25.11.2020;Auftraggeber2;Buchungstext2;Kategorie2;Verwendungszweck2;1.000,00;EUR;-10,00;EUR
02.11.2020;02.11.2020;Auftraggeber3;Buchungstext3;Kategorie3;Verwendungszweck3;1.000,00;EUR;-100,00;EUR
thesoundhead commented 3 years ago
CONFIG = [
    ECImporter(
        'DE00 0000 0000 0000 0000 00',
        'Assets:MyAccount',
        'Adam Bernhard Christopher Dow',
        file_encoding='ISO-8859-1',
    ),
]
siddhantgoel commented 3 years ago

Cool, thanks for the data. It looks like the export you're working with contains an extra "Kategorie" field.

At the moment, the importer expects the following:

Buchung;Valuta;Auftraggeber/Empfänger;Buchungstext;Verwendungszweck;Saldo;Währung;Betrag;Währung

... and the data you pasted contains this:

Buchung;Valuta;Auftraggeber/Empfänger;Buchungstext;Kategorie;Verwendungszweck;Saldo;Währung;Betrag;Währung

I'm actually not sure why that is the case. I just tried exporting my own data from ING and I don't see any "Kategorie" field in there. Probably some setting in ING somewhere that one could change and then these categories start appearing.

In any case, I'll try to have a look over the weekend if there's a way to introduce a compatibility to handle these variations.

thesoundhead commented 3 years ago

Cool, thanks for the data. It looks like the export you're working with contains an extra "Kategorie" field. [...] I'm actually not sure why that is the case. I just tried exporting my own data from ING and I don't see any "Kategorie" field in there. Probably some setting in ING somewhere that one could change and then these categories start appearing.

Thank you so much. You can setup your ING account to categorize some your transactions under "Services" -> "Analyse" -> "de-/activate". I deactivated it now to omit the "Kategorie" section and now it works.

siddhantgoel commented 3 years ago

Nice. I'll still try and see if there's an easy fix for this in the importer itself. Have been wanting to change a few things in there for a few days now anyway.

siddhantgoel commented 3 years ago

Resolved in v0.4.0.