Ask coding questions

← Back to all posts
URGENT: i don't know how to fix this syntax error in my game.py file
ArtemisNightingale

I need some urgent help on how to fix this syntax error in my game.py file. this is a part of an entry for a coding contest that's deadline is in less than a few days.


Comments
hotnewtop
MrVoo

You have TWO errors. The first one is literally told to you in the error message, there's an extra ) on line 9. The second one is an extra space in the indent of lines 19-21

ArtemisNightingale

@MrVoo I made the corrections as you say but now it's showing a
IndentationError to me. please help me.

MrVoo

@ArtemisNightingale Just look at your code, it's pretty obvious.... I think you have to move back lines 30 and 31

ArtemisNightingale

@MrVoo this is the first time I ever worked with pygame, everytime I seem to be able to correct an error another error pops up. like I redid the section you pointed out and now they say there's another syntax error. sorry for keeping on bothering you like this but I am a complete beginner when it comes to this.

MrVoo

@ArtemisNightingale Variables can't have spaces ._. Did you forget a comma?

ArtemisNightingale

@MrVoo I did it like in the tutorial I watched. do you know how I should do it?

MrVoo

@ArtemisNightingale Put a comma in between x and size

ArtemisNightingale

@MrVoo Thanks so much! it worked, after I fixed the indention error that was right after that the file no longer has any error. I know this may be annoying and a lot to ask but how do I fix the attribute error in the main.py?

MrVoo

@ArtemisNightingale g.running doesn't exist.

ArtemisNightingale

@MrVoo as in its not defined or am I supposed to code it in a different way using a different method?

MrVoo

@ArtemisNightingale What version is your tutorial, and why can't you just make it a while true statement?

ArtemisNightingale

@MrVoo I,m not sure what's a while true statement and it should be working because the guy is using the latest pygame version, 3.7.7 I believe.

ArtemisNightingale

@MrVoo I fixed it but now I,m having an import error.

ArtemisNightingale

@MrVoo thanks again for all your help! :) I really appreciate it. I will stop wasting your time now, I think I got it now.

ArtemisNightingale

any help or possible solutions would be appreciated!