Skip to content

Error in file_account #10

@gorbach

Description

@gorbach

It seems that following code:

    def file_account(self, filename):
        # example: monobank-black-UAH_22-10-22_14-24-57.csv
        print (filename)
        parts = filename.split("_")[0].split("-")
        return self.account_config[(parts[1], parts[2])]

does not handle full path, and fails on my system (windows 11):

  Exception in importer code.
  Traceback (most recent call last):
    File "C:\Python312\Lib\site-packages\beangulp\__init__.py", line 86, in _extract
      entries = extract.extract_from_file(importer, filename, existing_entries)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "C:\Python312\Lib\site-packages\beangulp\extract.py", line 40, in extract_from_file
      entries = importer.extract(filename, existing_entries)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "C:\Python312\Lib\site-packages\uabean\importers\monobank.py", line 81, in extract
      account = self.file_account(filename)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "C:\Python312\Lib\site-packages\uabean\importers\monobank.py", line 71, in file_account
      return self.account_config[(parts[1], parts[2])]
                                  ~~~~~^^^
  IndexError: list index out of range

If I print filename in debug, I get following:

C:\Users\gor\Documents\beancount\download\monobank-black-UAH_22-02-25_17-50-50.csv

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions