1👍
✅
NoneType
means that instead of an instance of a class, you’ve actually got None
. That probably means that an assignment failed or or function call returned an unexpected result. Your assignment to cart_item
is probably failing in the case where charm == False
. Check whatever code (assignment or function call) that’s setting those two variables.
0👍
Somehow your charm == False
condition also implies that cart_item.charm is None
. Since you don’t check for None
before you access the id
attribute, an exception is thrown.
I don’t know enough about these variables and object types to understand why but it’s that if
conditional that’s masking away your problem.
Source:stackexchange.com