beancount-dkb icon indicating copy to clipboard operation
beancount-dkb copied to clipboard

decimal.InvalidOperation: [<class 'decimal.ConversionSyntax'>] - beancount_dkb/credit.py", line 204, in _update_meta

Open mh182 opened this issue 4 months ago • 1 comments

Foremost, thanks for your work on this importer. I use it since a couple of years and it never failed me.

I recently switched my computer and had to reinstall beancount with the DKB-Importer. With the new install, I switched to beancount 3. I changed the configuration to use pyproject.toml. The use of beancount-dkb-ec work on my first try, but extracting my credit card information fails with an error.

I created a minimal example by deleting all transactions, except one (see below).

✦ ➜ beancount-dkb-credit --version
beancount-dkb-credit, version 0.1.1
# Identification works
✦ ➜ beancount-dkb-credit identify test-cc.csv
* /home/max/Documents/accounting/haushalt/test-cc.csv ... OK
  <bound method CreditImporter.name of <beancount_dkb.credit.CreditImporter object at 0x7fd12edd3c20>>
✦ ➜ beancount-dkb-credit extract test-cc.csv
* /home/max/Documents/accounting/haushalt/test-cc.csv ...  ERROR
  Exception in importer code.
  Traceback (most recent call last):
    File "/home/max/.local/share/uv/tools/beancount-dkb/lib/python3.12/site-packages/beangulp/__init__.py", line 86, in _extract
      entries = extract.extract_from_file(importer, filename, existing_entries)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "/home/max/.local/share/uv/tools/beancount-dkb/lib/python3.12/site-packages/beangulp/extract.py", line 40, in extract_from_file
      entries = importer.extract(filename, existing_entries)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "/home/max/.local/share/uv/tools/beancount-dkb/lib/python3.12/site-packages/beancount_dkb/credit.py", line 102, in extract
      return self._extract(filepath, extractor)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "/home/max/.local/share/uv/tools/beancount-dkb/lib/python3.12/site-packages/beancount_dkb/credit.py", line 131, in _extract
      self._update_meta(metadata)
    File "/home/max/.local/share/uv/tools/beancount-dkb/lib/python3.12/site-packages/beancount_dkb/credit.py", line 204, in _update_meta
      Decimal(amount.rstrip(" EUR")), self.currency
      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  decimal.InvalidOperation: [<class 'decimal.ConversionSyntax'>]

✦ ➜ cat test-cc.csv
"Karte","Visa Kreditkarte","4930 •••• •••• 0284"
""
"Saldo vom 12.10.2024:","-428,84 EUR"
""
"Belegdatum","Wertstellung","Status","Beschreibung","Umsatztyp","Betrag (€)","Fremdwährungsbetrag"
"09.10.24","11.10.24","Gebucht","RESTAURANT Foo","Im Geschäft","-21",""

System Information:

  • Debian unstable
  • Installation via uv which uses cpython-3.12.7-linux-x86_64-gnu
# Use uv as package installer
uv tool install beancount-dkb
# Create symbolic links for bean-* scripts - is there a better way?
ln -s "$(uv tool dir)"/beancount-dkb/bin/bean* ~/.local/bin/

mh182 avatar Oct 12 '24 12:10 mh182