This repository has been archived by the owner on Sep 28, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 19
Incomplete implementation of dictset.__getattr__
#144
Comments
vlcinsky
changed the title
Incomplete implementation of
Incomplete implementation of Jul 24, 2016
dictset.__getattrib__
dictset.__getattr__
hey @vlcinsky thanks for the PR! can you provide some steps to reproduce this? |
To reproduce the problem, see ramses-tech/ramses-example#59 |
Missed that. Did you install following these steps inside a virtualenv? |
Yes, to manage virtualenvs I use |
Simple test is: >>> from nefertari.utils.dictset import dictset
>>> dset = dictset({"a": 11, "b": 22})
>>> dset["a"]
11
>>> dset["b"]
22
>>> dset.a
11
>>> dset.b
22
>>> dset.c
KeyError Traceback (most recent call last)
<ipython-input-xy> in <module>()
----> 1 getattr(dset, "c", None)
.tox/py27/local/lib/python2.7/site-packages/nefertari/utils/dictset.pyc in __getattr__(self, key)
28
29 def __getattr__(self, key):
---> 30 return self[key]
31
32 def __setattr__(self, key, val):
KeyError: 'c'
>>> getattr(dset, "a", None)
11
>>> getattr(dset, "b", None)
22
>>> getattr(dset, "c", None)
KeyError Traceback (most recent call last)
<ipython-input-xy> in <module>()
----> 1 getattr(dset, "c", None)
.tox/py27/local/lib/python2.7/site-packages/nefertari/utils/dictset.pyc in __getattr__(self, key)
28
29 def __getattr__(self, key):
---> 30 return self[key]
31
32 def __setattr__(self, key, val):
KeyError: 'c' Note the last error: asking for value of non-existent attribute using |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
https://github.com/ramses-tech/nefertari/blob/master/nefertari/utils/dictset.py#L29 fails when request for non-existent attribute is done.
In some situation the problem may be hidden by using
simplejson
with installed speedups.PR #143 resolves the problem.
The text was updated successfully, but these errors were encountered: