Ask coding questions

← Back to all posts
NEED SOME URGENT HELP: How do i fix this attribution error
ArtemisNightingale

this is a part of an entry for completion that's deadline is in a fed says. I had run into some errors and got some help from someone on this board. then I went I fixed the rest of it but now I am stuck on this attribution error that I don't know how to fix. This is the first time I am working with pygame, so I am pretty much a total beginner. any help again would be greatly appreciated.

Voters
ArtemisNightingale
Comments
hotnewtop
Coder100

hi, you made a typo:

the correct way to initialize a function is to use __init__
so do that

ArtemisNightingale

@Coder100 thanks a lot! but did you spot any other typos by chance because no I have an attribution error of, Game object has no attribute UP_KEY

Coder100

@ArtemisNightingale don't forget to indent all of this:

so it has all the same indentation as the class.

ArtemisNightingale

@Coder100 got it! but do you know how to fix the syntax error that's popping up for line 2? i don't see whats wrong

Coder100

do you mean import menu or from menu import * because when you import using from import you have to specify what you want to import. @ArtemisNightingale

ArtemisNightingale

@Coder100 understood. I corrected it to "from menu import*". I think it almost worked but now they're saying there is a type error.

JustCoding123

In the Game class the function _init_ should be __init__.

ArtemisNightingale

@JustCoding123 I did that but now it says the Game object has no attribute up key, is it another typo I need to fix?

JustCoding123

@ArtemisNightingale Fixed it

ArtemisNightingale

@JustCoding123 thanks so much for the help! after I put in the changes you said and fixed the indention errors, I am now having a syntax error of line 2. I don't see the problem in it though?

JustCoding123

@ArtemisNightingale In the MainMenu class you again wrote _init_ and not __init__

ArtemisNightingale

I honestly don't know how to fix this problem.