Ask coding questions

← Back to all posts
Attribute Error?
wantT0befriends (43)

Hi guys, can you help me here?

I've learned a little about classes in python and once I did, I realized I had made a big mistake in one of my projects.

I could have made it much simpler with what I just learned.

So I happily replaced all the complex dictionaries, ID thingies, and other confusing stuff with just a simple class.

But then there was errors. SO. MANY. ERRORS. I fixed lots, until this one showed up: AttributeError: 'str' object has no attribute 'moves'

As you know, I had just learned classes so I didn't know how to deal with this.

print('As it seems, though, that's why I ask for your help.')

So can you help me? Ill give you a cookie if u do

Answered by Coder100 (18904) [earned 5 cycles]
View Answer
Coder100 (18904)

hey, just a naming convention, name all your classes with uppercase:
Po instead of po for readability and better distinguishability between functions and classes

PattanAhmed (1412)

@wantT0befriends Hi Matthew,
You just named the class and functions with the same name which really makes Python mad...
So for now, Just change the function name to some other random name!
And Try!
Any more errors? Please feel free to Comment me below!

With my best wishes
Hope this helps
Please mark my answer if this helps

Leroy01010 (408)

coder100 commented on this!!

what you said:
So can you help me? Ill give you a cookie if u do.