Skip to content

avoiding autoregistry.exceptions.KeyCollisionError #181

@jsiverskog

Description

@jsiverskog

hi,
we're using importlib.util.module_from_spec to find classes in a number of files. one of these files contain a Device subclass. when that file is parsed the second time (since it's imported subclassed from another file) belay causes this crash:

autoregistry.exceptions.KeyCollisionError: "iohubwithusbflipper" already registered to {'iohub': <IoHub: ['iohubv3', 'iohubv2', 'iohubv1', 'iohubwithusbflipper']>, 'iohubv3': <IoHubV3: ['iohubwithusbflipper']>, 'iohubv2': <IoHubV2: []>, 'iohubv1': <IoHubV1: []>, 'stacklight': <Stacklight: []>, 'iohubwithusbflipper': <IoHubWithUsbFlipper: []>}

i saw that autoregistry supports an overwrite argument to avoid this error, but is there any way i can set the overwrite argument to True through belay?

thanks, jacob

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions