madhat2r / plaid2text

Python Scripts to export Plaid transactions and transform them into Ledger or Beancount syntax formatted files.
GNU General Public License v3.0
89 stars 19 forks source link

Crash related to tag parsing #11

Open JoshLipschultz opened 8 years ago

JoshLipschultz commented 8 years ago

Occasionally when processing tags, a few things can happen:

2016-09-09 00:00:00 COFFEE                        2.23
Payee [Coffee]:
Account [Expenses:Food:Coffee]:
Tag [## ## #t #h #i #s #- #t #a #g]: this-tag
Tag [## ## #t #h #i #s #- #t #a #g]: 

And the error:

Traceback (most recent call last):
  File "/usr/local/bin/plaid2text", line 6, in <module>
    exec(compile(open(__file__).read(), __file__, 'exec'))
  File ".../plaid2text/bin/plaid2text", line 2, in <module>
    from plaid2text.plaid2text import main;main()
  File ".../plaid2text/src/python/plaid2text/plaid2text.py", line 352, in main
    update_dict = out.process_transactions()
  File ".../plaid2text/src/python/plaid2text/renderers.py", line 166, in process_transactions
    out = self._process_plaid_transactions()
  File ".../plaid2text/src/python/plaid2text/renderers.py", line 180, in _process_plaid_transactions
    payee, account, tags = self.get_payee_and_account(entry)
  File ".../plaid2text/src/python/plaid2text/renderers.py", line 238, in get_payee_and_account
    value = self.prompt_for_tags('Tag', self.possible_tags, tags)
  File ".../plaid2text/src/python/plaid2text/renderers.py", line 395, in prompt_for_tags
    tags.append(value)
AttributeError: 'str' object has no attribute 'append'

Basically it looks like the prompt_for_tags is treating tags as both a string and a list in difference places, which is causing the issue.

I should be able to fix this later, but I wanted to write this up in case you had identified the problem and had done it already.

madhat2r commented 8 years ago

Thanks for the report @JoshLipschultz. I have not yet encountered this issue.

If you can fix it that would be awesome, send me a PR.

I will look at this when I get some time otherwise. I am up to my eyes in some other stuff right now so it will be at least a couple of weeks before I can get to it.