rienafairefr / pynYNAB

a python client for the new YNAB
MIT License
138 stars 12 forks source link

TypeError: __hash__ method should return an integer while creating a client #21

Closed tovolkmar closed 7 years ago

tovolkmar commented 7 years ago

Hi,

when i create a new client, i get the following error:

 File "ynab.py", line 13, in <module>
    client = clientfromargs(args)
  File "/usr/local/lib/python3.5/site-packages/pynYNAB-0.1-py3.5.egg/pynYNAB/Client.py", line 16, in clientfromargs
    client = nYnabClient(connection, budget_name=args.budgetname)
  File "/usr/local/lib/python3.5/site-packages/pynYNAB-0.1-py3.5.egg/pynYNAB/Client.py", line 43, in __init__
    self.sync()
  File "/usr/local/lib/python3.5/site-packages/pynYNAB-0.1-py3.5.egg/pynYNAB/Client.py", line 67, in sync
    self.budget.sync(self.connection, 'syncBudgetData')
  File "/usr/local/lib/python3.5/site-packages/pynYNAB-0.1-py3.5.egg/pynYNAB/roots.py", line 42, in sync
    self.update_from_changed_entities(changed_entities)
  File "/usr/local/lib/python3.5/site-packages/pynYNAB-0.1-py3.5.egg/pynYNAB/Entity.py", line 173, in update_from_changed_entities
    getattr(self, namefield).update_from_changed_entities(changed_entities.get(namefield))
  File "/usr/local/lib/python3.5/site-packages/pynYNAB-0.1-py3.5.egg/pynYNAB/Entity.py", line 226, in update_from_changed_entities
    self._update_hashes()
  File "/usr/local/lib/python3.5/site-packages/pynYNAB-0.1-py3.5.egg/pynYNAB/Entity.py", line 199, in _update_hashes
    self._dict_entities_hash = {hash(v): v for k, v in self._dict_entities.items()}
  File "/usr/local/lib/python3.5/site-packages/pynYNAB-0.1-py3.5.egg/pynYNAB/Entity.py", line 199, in <dictcomp>
    self._dict_entities_hash = {hash(v): v for k, v in self._dict_entities.items()}
TypeError: __hash__ method should return an integer

My python script to create the client looks like that:

import configargparse

from pynYNAB.Client import clientfromargs
from pynYNAB.schema.budget import Payee, Transaction
from pynYNAB.scripts.config import get_logger, test_common_args

parser = configargparse.getArgumentParser('pynYNAB')
args = parser.parse_args()
args.email = "user"
args.password = "password"
args.budgetname = "Cookier"

client = clientfromargs(args)

accounts = {x.account_name: x for x in client.budget.be_accounts}
print (accounts)

Does i have an error while creating the account, or is it a problem with the api?

Thanks for your help in advance.

Best regards, Tobias

rienafairefr commented 7 years ago

Hi, This is because the pypi release was lagging quite a bit with the code here. The 0.2 release that I just pushed on pypi should work much better 👍 Sorry about that