Skip to content

Driver refresh() fails with DictFeats #69

@Duncanla

Description

@Duncanla

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 ""

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions