Qualtran icon indicating copy to clipboard operation
Qualtran copied to clipboard

No '__dict__' attribute on 'CtrlSpec' instance to cache 'shapes' property.

Open lamq317 opened this issue 9 months ago • 8 comments

Hello, I have installed the latest state of the main branch and wanted to define a controlled version of a Bloq, but ran into an error of the form: "No 'dict' attribute on 'CtrlSpec' instance to cache 'shapes' property." when using show_bloq to visualize the controlled bloq. Indeed I tested one of the scripts that you have posted as part of the documentation:

from qualtran.bloqs.for_testing import TestAtom atom = TestAtom() catom = atom.controlled() show_bloq(catom)

and got the same error. Here I am showing the last lines of the error when executing the script in a Jupyter notebook:

989 except AttributeError:  # not all objects have __dict__ (e.g. class defines slots)
    990     msg = (
    991         f"No '__dict__' attribute on {type(instance).__name__!r} "
    992         f"instance to cache {self.attrname!r} property."
    993     )
--> 994     raise TypeError(msg) from None
    995 val = cache.get(self.attrname, _NOT_FOUND)
    996 if val is _NOT_FOUND:

TypeError: No '__dict__' attribute on 'CtrlSpec' instance to cache 'shapes' property.

lamq317 avatar May 13 '24 18:05 lamq317