beeficecream / YNABDashboard

Resources required to setup and display Grafana dashboards using InfluxDB data generated through exporting and inserting YNAB budget data
GNU General Public License v3.0
43 stars 6 forks source link

TypeError: unsupported operand type(s) for /: 'NoneType' and 'int' #6

Open fergbrain opened 4 years ago

fergbrain commented 4 years ago

I'm getting the following error when I run main.py:

Traceback (most recent call last):
  File "main.py", line 55, in <module>
    budget = ynab.get_budget_by_id_detailed(ynab_budget_id)
  File "/usr/src/app/ynab_client.py", line 78, in get_budget_by_id_detailed
    budget = ynab_resources.Budget(json_data["budget"],details=True)
  File "/usr/src/app/ynab_resources.py", line 36, in __init__
    self.get_details(json_data)
  File "/usr/src/app/ynab_resources.py", line 40, in get_details
    self.categories = [Category(data) for data in json_data["categories"]]
  File "/usr/src/app/ynab_resources.py", line 40, in <listcomp>
    self.categories = [Category(data) for data in json_data["categories"]]
  File "/usr/src/app/ynab_resources.py", line 86, in __init__
    self.goal_target = convert_currency(self=None,currency=json_data["goal_target"])
  File "/usr/src/app/ynab_resources.py", line 4, in convert_currency
    output = round(currency/1000,2)
TypeError: unsupported operand type(s) for /: 'NoneType' and 'int'

Note: using a try/except makes the error go away, though I'm not sure if it fixes the root cause.

josh-wong commented 3 years ago

I'm getting a similar error.

Traceback (most recent call last): File "YNAB/main.py", line 55, in budget = ynab.get_budget_by_id_detailed(ynab_budget_id) File "/home/pi/YNAB/ynab_client.py", line 78, in get_budget_by_id budget = ynab_resources.Budget(json_data["budget"],details=True) File "/home/pi/YNAB/ynab_resources.py", line 35, in init self.get_details(json_data) File "/home/pi/YNAB/ynab_resources.py", line 53, in get_details t.payee_name = [p.name for p in self.payees if p.id == t.payee_id][0] IndexError: list index out of range

Does this dashboard still work? Or have there been API updates to YNAB that break the dashboard?

If the dashboard still works, can you please write up detailed step-by-step instructions? It's currently a bit vague how to install/set up everything.