-
Notifications
You must be signed in to change notification settings - Fork 58
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
AttributeError: 'tuple' object has no attribute 'model' #99
Comments
Mmmm, this is strange, can you try this on your installation? In [2]: from uds import models In [3]: objtype.ObjectType.from_model(models.Service.objects.first()) Should return and ObjTypeInfo object, not a tuple. The used of [1] is fine, but the strange thing here is that it should be a named tuple... As all members are ObjTypeInfo (if i didn't miss anything... :P) class ObjectType(enum.Enum): No tuple is used on the enum... Let me know the results please. |
yep, here is the output
|
Can you paste your objtype.py file here please? I have included a couple of changes, but only to add some more info, and a consisntence one: Also, my output from your [4..]: In [4]: objtype.ObjectType.PROVIDER In [5]: objtype.ObjectType.PROVIDER.value In [6]: x = objtype.ObjectType.PROVIDER In [7]: x.model Weird :P |
all changes not related to objtype |
more detail about my env:
|
It's fine, all variables are initialized to "ObjInfoType", not Tuples :S can you try also this? In [1]: import typing In [2]: class Test(typing.NamedTuple): In [3]: Test(1, 'b') |
Seems the problem is with 3.11.1: The NamedTuple is converted to Tuples, so update to at least 3.11.2. It's a python 3.11.1 bug :S (that was weird :P) |
I worked! Thanks |
Hi, I found another exception
I think it related to casting enum element here to ObjTypeInfo.
I fix by change from
return self.value.model
toreturn self.value[1]
code, but i think it's not right with your design.The text was updated successfully, but these errors were encountered: