Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Driver refresh() fails with DictFeats #69

Open
Duncanla opened this issue Jun 9, 2016 · 0 comments
Open

Driver refresh() fails with DictFeats #69

Duncanla opened this issue Jun 9, 2016 · 0 comments

Comments

@Duncanla
Copy link

Duncanla commented Jun 9, 2016

This error occurs when trying to refresh() a driver with DictFeats:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python3.5/site-packages/lantz/feat.py", line 487, in __repr__
    return repr(self.df.value[self.instance])
  File "/usr/lib/python3.5/weakref.py", line 365, in __getitem__
    return self.data[ref(key)]
KeyError: <weakref at 0x7f6d12c9fa98; to 'DriverName' at 0x7f6d202fc558>

If I initialize all of the DictFeats (simply by reading from at least one key for each one), then everything works fine.

This modification to _DictFeatAccesor works around the problem, although I'm not sure if it is a good solution:

def __repr__(self):
    if self.instance in self.df.value.keys():
        return repr(self.df.value[self.instance])
    else:
        return ""
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant