Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #111630 > unrolled thread

an error

Started byWePlayGames WeEnjoyIt <crazyguyplaying13@gmail.com>
First post2016-07-18 23:07 -0700
Last post2016-07-19 19:24 +0200
Articles 9 — 5 participants

Back to article view | Back to comp.lang.python


Contents

  an error WePlayGames WeEnjoyIt <crazyguyplaying13@gmail.com> - 2016-07-18 23:07 -0700
    Re: an error Chris Angelico <rosuav@gmail.com> - 2016-07-19 16:20 +1000
      Re: an error WePlayGames WeEnjoyIt <crazyguyplaying13@gmail.com> - 2016-07-18 23:26 -0700
        Re: an error Chris Angelico <rosuav@gmail.com> - 2016-07-19 16:32 +1000
          Re: an error WePlayGames WeEnjoyIt <crazyguyplaying13@gmail.com> - 2016-07-18 23:37 -0700
            Re: an error Chris Angelico <rosuav@gmail.com> - 2016-07-19 16:45 +1000
    Re: an error Ian Kelly <ian.g.kelly@gmail.com> - 2016-07-19 00:20 -0600
    Re: an error Terry Reedy <tjreedy@udel.edu> - 2016-07-19 05:12 -0400
    Re: an error Laurent Pointal <laurent.pointal@free.fr> - 2016-07-19 19:24 +0200

#111630 — an error

FromWePlayGames WeEnjoyIt <crazyguyplaying13@gmail.com>
Date2016-07-18 23:07 -0700
Subjectan error
Message-ID<175aeac6-b975-425b-b2b1-580a64ce0854@googlegroups.com>
while True:
 for event in pygame.event.get():
  if event.type==pygame.QUIT:
   pygame.quit()
   sys.exit()
 pygame1.blit(image1,(0,0))
 print ("choose from 0-8")
 p1=int(input())
 while p1>8 or p1<0 or list_b[p1]=="X" or list_b[p1]=="O":
        print ("wtf bro")
        p1=int(input())
 list_b[p1]="X"
 if p1==0:
          pygame1.blit(image2,(31,36))
 elif p1==1:
          pygame1.blit(image2,(90,36))
 elif p1==2:
          pygame1.blit(image2,(143,36))
 elif p1==3:
         pygame1.blit(image2,(31,90))
 elif p1==4:
         pygame.blit(image2,(90,90))
 elif p1==5:
          pygame1.blit(image2,(143,90))
 elif p1==6:
          pygame1.blit(image2,(31,146))
 elif p1==7:
          pygame1.blit(image2,(90,146))
 elif p1==8:
          pygame1.blit(image2,(143,146))

 total+=1
 print ("choose from 0-8")
 p2=int(input())
 while p2>8 or p2<0 or list_b[p2]=="X" or list_b[p2]=="O":
        print ("wtf bro")
        p2=int(input())
 list_b[p2]=="O"
 if p2==0:
  pygame1.blit(image3,(31,36))
 elif p2==1:
   pygame1.blit(image3,(90,36))
 elif p2==2:
   pygame1.blit(image3,(143,36))
 elif p2==3:
   pygame1.blit(image3,(31,90))
 elif p2==4:
   pygame1.blit(image3,(90,90))
 elif p2==5:
   pygame1.blit(image3,(143,90))
 elif p2==6:
   pygame1.blit(image3,(31,146))
 elif p2==7:
   pygam1e.blit(image3,(90,146))
 elif p2==8:
   pygame1.blit(image3,(143,146)
 total+=1
 fps=40
 clockfps.tick(fps)
 pygame.display.update()


the problem with this is that i get an syntax error at the very end at the TOTAL+=1 when i delete this it tells me that there is an error at the clockfps.tick(fps) thing what the heck is going on :p

[toc] | [next] | [standalone]


#111631

FromChris Angelico <rosuav@gmail.com>
Date2016-07-19 16:20 +1000
Message-ID<mailman.83.1468909207.2307.python-list@python.org>
In reply to#111630
On Tue, Jul 19, 2016 at 4:07 PM, WePlayGames WeEnjoyIt
<crazyguyplaying13@gmail.com> wrote:
> the problem with this is that i get an syntax error at the very end at the TOTAL+=1 when i delete this it tells me that there is an error at the clockfps.tick(fps) thing what the heck is going on :p
>

When you get an error, Python gives you a very useful error message
(and traceback, although that doesn't apply to syntax errors like
this). Copy and paste that here. There are many possible syntax
errors, and Python will tell you which one.

ChrisA

[toc] | [prev] | [next] | [standalone]


#111633

FromWePlayGames WeEnjoyIt <crazyguyplaying13@gmail.com>
Date2016-07-18 23:26 -0700
Message-ID<6c990c11-c4b5-4ee8-8ee9-488bfe56784d@googlegroups.com>
In reply to#111631
Τη Τρίτη, 19 Ιουλίου 2016 - 9:20:20 π.μ. UTC+3, ο χρήστης Chris Angelico έγραψε:
> On Tue, Jul 19, 2016 at 4:07 PM, WePlayGames WeEnjoyIt
> <crazyguyplaying13@gmail.com> wrote:
> > the problem with this is that i get an syntax error at the very end at the TOTAL+=1 when i delete this it tells me that there is an error at the clockfps.tick(fps) thing what the heck is going on :p
> >
> 
> When you get an error, Python gives you a very useful error message
> (and traceback, although that doesn't apply to syntax errors like
> this). Copy and paste that here. There are many possible syntax
> errors, and Python will tell you which one.
> 
> ChrisA

thanks chris for responding, it doesnt say anything else just syntax error
it have seen this error again when im using the for loop and it seems like when i delete everything after total+=1 i get a different error called UNEXPECTED EOF WHILE PARSING

[toc] | [prev] | [next] | [standalone]


#111634

FromChris Angelico <rosuav@gmail.com>
Date2016-07-19 16:32 +1000
Message-ID<mailman.85.1468909943.2307.python-list@python.org>
In reply to#111633
On Tue, Jul 19, 2016 at 4:26 PM, WePlayGames WeEnjoyIt
<crazyguyplaying13@gmail.com> wrote:
> thanks chris for responding, it doesnt say anything else just syntax error
> it have seen this error again when im using the for loop and it seems like when i delete everything after total+=1 i get a different error called UNEXPECTED EOF WHILE PARSING

Are you sure it says nothing else? Copy and paste exactly what happens
when you type "python3 yourgamename.py".

Exactly what happens.

ChrisA

[toc] | [prev] | [next] | [standalone]


#111635

FromWePlayGames WeEnjoyIt <crazyguyplaying13@gmail.com>
Date2016-07-18 23:37 -0700
Message-ID<ebfcd881-528e-4e3e-9f96-da65a4ae1450@googlegroups.com>
In reply to#111634
Τη Τρίτη, 19 Ιουλίου 2016 - 9:32:34 π.μ. UTC+3, ο χρήστης Chris Angelico έγραψε:
> On Tue, Jul 19, 2016 at 4:26 PM, WePlayGames WeEnjoyIt
> <crazyguyplaying13@gmail.com> wrote:
> > thanks chris for responding, it doesnt say anything else just syntax error
> > it have seen this error again when im using the for loop and it seems like when i delete everything after total+=1 i get a different error called UNEXPECTED EOF WHILE PARSING
> 
> Are you sure it says nothing else? Copy and paste exactly what happens
> when you type "python3 yourgamename.py".
> 
> Exactly what happens.
> 
> ChrisA

ITS OK the problem was solved i forgot to close the thingy like ian said but now i got more problems ( not errors however). like i know how to load and blit a picture in my pygame window but i dont know why it wont work in this code, like nothing is actually appearing in my screen. long story short what i want to happend is image1 to appear in but it doesnt

[toc] | [prev] | [next] | [standalone]


#111636

FromChris Angelico <rosuav@gmail.com>
Date2016-07-19 16:45 +1000
Message-ID<mailman.86.1468910710.2307.python-list@python.org>
In reply to#111635
On Tue, Jul 19, 2016 at 4:37 PM, WePlayGames WeEnjoyIt
<crazyguyplaying13@gmail.com> wrote:
> Τη Τρίτη, 19 Ιουλίου 2016 - 9:32:34 π.μ. UTC+3, ο χρήστης Chris Angelico έγραψε:
>> On Tue, Jul 19, 2016 at 4:26 PM, WePlayGames WeEnjoyIt
>> <crazyguyplaying13@gmail.com> wrote:
>> > thanks chris for responding, it doesnt say anything else just syntax error
>> > it have seen this error again when im using the for loop and it seems like when i delete everything after total+=1 i get a different error called UNEXPECTED EOF WHILE PARSING
>>
>> Are you sure it says nothing else? Copy and paste exactly what happens
>> when you type "python3 yourgamename.py".
>>
>> Exactly what happens.
>>
>> ChrisA
>
> ITS OK the problem was solved i forgot to close the thingy like ian said but now i got more problems ( not errors however). like i know how to load and blit a picture in my pygame window but i dont know why it wont work in this code, like nothing is actually appearing in my screen. long story short what i want to happend is image1 to appear in but it doesnt
>

It's important not just to solve your problem, but to learn *how* to
solve problems. Learning to read tracebacks is essential to being a
Python programmer.

ChrisA

[toc] | [prev] | [next] | [standalone]


#111632

FromIan Kelly <ian.g.kelly@gmail.com>
Date2016-07-19 00:20 -0600
Message-ID<mailman.84.1468909300.2307.python-list@python.org>
In reply to#111630
On Tue, Jul 19, 2016 at 12:07 AM, WePlayGames WeEnjoyIt
<crazyguyplaying13@gmail.com> wrote:
>    pygame1.blit(image3,(143,146)

This line is missing a closing parenthesis.

[toc] | [prev] | [next] | [standalone]


#111637

FromTerry Reedy <tjreedy@udel.edu>
Date2016-07-19 05:12 -0400
Message-ID<mailman.87.1468919555.2307.python-list@python.org>
In reply to#111630
On 7/19/2016 2:07 AM, WePlayGames WeEnjoyIt wrote:

>    pygame1.blit(image3,(143,146)

If you type this line (including \n) into IDLE's Python-aware editor, it 
will notice that there is an open parenthesis for a function call and 
indent the next line to the space under the 'i' of image.  This is 
because you either A) did not make a mistake and intend to type more 
before the closing parenthesis, and according to PEP 8, lined up with 
'i' is the place to start, or B) you did make a mistake and should 
notice the indent as a signal.

-- 
Terry Jan Reedy

[toc] | [prev] | [next] | [standalone]


#111641

FromLaurent Pointal <laurent.pointal@free.fr>
Date2016-07-19 19:24 +0200
Message-ID<578e6261$0$23756$426a74cc@news.free.fr>
In reply to#111630
WePlayGames WeEnjoyIt wrote:

<zip>
>  elif p2==8:
>    pygame1.blit(image3,(143,146) <============= missing )
>  total+=1
>  fps=40
>  clockfps.tick(fps)
>  pygame.display.update()
> 
> the problem with this is that i get an syntax error at the very end at the
> TOTAL+=1 when i delete this it tells me that there is an error at the
> clockfps.tick(fps) thing what the heck is going on :p

Someone else shows you the error.

When you have a syntax error in a specific line (see printed traceback), it 
is common to have to look at previous lines to identify some open 
parenthesis, brackets, square brackets with missing close one.

A+
Laurent.

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web