You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When inheriting from base, I am unable to run a script twice without getting a value error my custom class. Looks like some persistent global registry object isn't getting properly refreshed on each run?
I'm creating the object below, and I get this error when running twice:
Hey @cslotboom, it would be nice to understand where you are running this script. The execution environment is probably trying to re-parse your code in a running environment.
I can only reproduce this in a plain python script by registering the same class in 2 different places:
Traceback (most recent call last):
File "/home/gergojedlicska/Speckle/specklepy/example/register.py", line 13, in <module>
class PointGroup(Base, speckle_type="UserObject"):
File "/home/gergojedlicska/Speckle/specklepy/src/specklepy/objects/base.py", line 174, in __init_subclass__
raise ValueError(
ValueError: The speckle_type: UserObject is already registered for type: PointGroup. Please choose a different type name.
so most probably this is what is happening in your scripting environment. Ideally this situation would be avoided, by only running the class definition once on startup, cause we have no extensive check to make sure the two type definitions match 1-1.
If you override the type definition with some differences, things can get weird unexpectedly
When inheriting from base, I am unable to run a script twice without getting a value error my custom class. Looks like some persistent global registry object isn't getting properly refreshed on each run?
I'm creating the object below, and I get this error when running twice:
System Info
WIndows 11,
specklepy = 2.21
The text was updated successfully, but these errors were encountered: