The line before needs another ')', like this: if not foundone: # if target not found print("Cannot find %s" % (target))
On Wed, Apr 29, 2009 at 5:30 PM, Yanom Mobis <ya...@rocketmail.com> wrote: > eh? what do you mean, missing and ending? > > --- On *Wed, 4/29/09, RB[0] <roeb...@gmail.com>* wrote: > > > From: RB[0] <roeb...@gmail.com> > Subject: Re: [pygame] Function problem > To: pygame-users@seul.org > Date: Wednesday, April 29, 2009, 5:00 PM > > > The line just before the error is missing and ending ) ;) > > On Wed, Apr 29, 2009 at 4:45 PM, Yanom Mobis > <ya...@rocketmail.com<http://mc/compose?to=ya...@rocketmail.com> > > wrote: > >> full code: >> >> #!/usr/bin/env python >> # This program is free software; you can redistribute it and/or >> modify >> # it under the terms of the GNU General Public License as published >> by >> # the Free Software Foundation; either version 2 of the License, or >> # (at your option) any later version. >> # >> # This program is distributed in the hope that it will be useful, >> # but WITHOUT ANY WARRANTY; without even the implied warranty of >> # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the >> # GNU General Public License for more details. >> # >> # You should have received a copy of the GNU General Public License >> # along with this program; if not, write to the Free Software >> # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, >> # MA 02110-1301, USA. >> >> import random >> >> class Mage(object): >> def __init__(self, name, initmana, initlife): >> self.name = name >> self.mana = initmana >> self.life = initlife >> def __str__(self): >> '''ouput given when class is printed''' >> return "%s: %i life, %i mana" % (self.name, self.life, self.mana) >> def cast(target): >> for item in magi: >> if item.name == target: #if we've found the right target >> item.life = item.life-random.randrange(10, 30) >> foundone = True #found the target >> if not foundone: # if target not found >> print("Cannot find %s" % (target) >> >> def pymageinit(): >> global magi >> magi = [Mage("Player",20, 200), Mage("Arcawen",20, 200)] >> >> >> def main(): >> Mage.cast("Player") >> for item in magi: >> print(item) >> return 0 >> >> if __name__ == '__main__': >> pymageinit() >> main() >> >> error: >> >> File "main.py", line 36 >> def pymageinit(): >> ^ >> SyntaxError: invalid syntax >> >> >> >> >> --- On *Tue, 4/28/09, Tyler Laing >> <trinio...@gmail.com<http://mc/compose?to=trinio...@gmail.com> >> >* wrote: >> >> >> From: Tyler Laing >> <trinio...@gmail.com<http://mc/compose?to=trinio...@gmail.com> >> > >> Subject: Re: [pygame] Function problem >> To: pygame-users@seul.org <http://mc/compose?to=pygame-us...@seul.org> >> Date: Tuesday, April 28, 2009, 6:46 PM >> >> >> You're going to need to show us the entire file, sorry Yanom. Can't tell >> anything from that one function. The error however, is not caused by that >> function, but by whatever comes before it. Maybe an unbalanced parenthesis? >> >> On Tue, Apr 28, 2009 at 4:45 PM, Yanom Mobis >> <ya...@rocketmail.com<http://mc/compose?to=ya...@rocketmail.com> >> > wrote: >> >>> This error: >>> >>> File "main.py", line 36 >>> def pymageinit(): >>> ^ >>> SyntaxError: invalid syntax >>> >>> is caused by this function: >>> >>> def pymageinit(): >>> global magi >>> magi = [Mage("Player",20, 200), Mage("Arcawen",20, 200)] >>> >>> >>> >>> does anyone know what i'm doing wrong? >>> >>> >> >> >> -- >> Visit my blog at http://oddco.ca/zeroth/zblog >> >> >> > > -- Jake