seltzered / fava-classy-portfolio

Fava Extension for viewing your financial portfolio kept in a Beancount plaintext accounting ledger.
22 stars 5 forks source link

Red error bar. #3

Open redstreet opened 4 years ago

redstreet commented 4 years ago

When I try this out, I simply get this in a red bar in fava:

Loading http://localhost:8081/main-accounts/extension/FavaClassyPortfolio/ failed.

There is no error output on the console where I started fava. How do I debug this? Thanks!

Originally posted by @redstreet in https://github.com/seltzered/fava-classy-portfolio/issues/1#issuecomment-562992486

seltzered commented 4 years ago

Haven't forgotten about this, just haven't had time. Will try to take a look tomorrow. The last todo note I had when trying to look at this was finding some way to add traceback printing.

If you have an example file of where things are failing that's a bit closer to your use that'll help. Think one example i had was mispelling things in the options list (e.g. 'account_open_mettttttdata_pattern' )

redstreet commented 4 years ago

Thanks a bunch! Unfortunately, it doesn't fail on any of my simpler examples, but only on my actual source. So I've not easily been able to narrow down the problem. Which is why I was trying to figure out how to obtain a traceback :).

seltzered commented 4 years ago

I should refactor this, but just to hastily try something try the latest commit: https://github.com/seltzered/fava-classy-portfolio/commit/5732cac58413bed0d1845052fbac83c55df0f405

redstreet commented 4 years ago

Thanks! I can see the trace now and added prints, but need help interpreting what's occurring:

Traceback (most recent call last):
  File "__init__.py", line 82, in portfolio_accounts
    True),
  File "__init__.py", line 403, in insert_rowspans
    False)
  File "__init__.py", line 438, in insert_rowspans
    False)
  File "__init__.py", line 460, in insert_rowspans
    data[key][coltype[0]], {"rowspan": 1})
KeyError: 'asset_subclass_allocation'
key = nosubclass
coltype == ('asset_subclass_allocation', "<class 'plugins.fava-classy-portfolio.DecimalPercent'>") 

data[nosubclass] exists but that dictionary, of course, doesn't contain 'asset_subclass_allocation'

Any leads appreciated, thanks.

seltzered commented 4 years ago

Huh, similar issue to what @grostim was having in #4 , have you looked at my example project to get an idea of what could be different? Are your accounts using a non-english language?

(My mind hasn't been in this space in a while so may have another reply later.)

redstreet commented 4 years ago

The example works fine. I can't tell how my sources could be different. No other character set.

Sure, sounds good. Regardless of this issue, your plugin is a helpful example for other plugins I want to write, so thanks for that!