AttributeError: ‘str’ object has no attribute ‘name’:
During testing I keep getting the error “AttributeError: ‘str’ object has no attribute ‘name’” when calling the transfer function.
It does not seem to register category as a new instance of the class. It is reading it as a string. I am building the code in VS code and then will move it over and adjust when I complete it, if that matters.
I also realized in this picture I accidently removed the line in my transfer function where I create an if statement that says if I have enough to complete the transfer. (I will add that on my end)
First, pleae try to post code - not images, in part so I don’t have to write the code…
Anyway, the error is right there: food.transfer(50, "clothing")
You are passing a string in the second argument NOT the clothing-object
The correct way would be food.transfer(50, clothing)
Also you gave the clothing object the name “Business”, so you might wanna change that to not get irritated later on.
Make sure you use the option above the text-input of the forum to properly format the link. I think the forum tries to turn blank links into a preview, which for replit and others turns up blank → thus it fails to actually create a clickable element.