[Tutor] Why does invalid syntax pop up?

Alan G alan.gauld at freenet.co.uk
Thu Jul 7 23:02:38 CEST 2005


>  Why does invalid syntax popup?

If you show us the error message it will probably tell us.
Thats what the error messages are for. They may look cryptic when 
you start out but they generally give you a clue as to roughly 
the right bit of the program and the reason.

Can you repost with the error to save us reading and analysing 
all of your code.

Thanks,

Now a quick scan through shows up some strangely indented print 
statements, is it those that are being complained about:


  def lookup_login_command(site,filename):
      print "Lookup a login info card"

there is an indentation mismatch between these lines.

          site = raw_input("Site: ")
          if sitelist.has_key(site):
              print "The ID is: ",sitelist[site][0]
              print "The password is: ",sitelist[site][1]
          else:
              print site," was not found."

Alan G
Author of the Learn to Program web tutor
http://www.freenetpages.co.uk/hp/alan.gauld


More information about the Tutor mailing list