<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.2900.2668" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY style="COLOR: #000000; FONT-FAMILY: Times New Roman" bgColor=#ffffff>
<BLOCKQUOTE id=0><LABEL id=HbSession SessionId="304588207"></LABEL>
  <DIV>Hi all,</DIV>
  <DIV>&nbsp;</DIV>
  <DIV>Why does invalid syntax popup?</DIV>
  <DIV>&nbsp;</DIV>
  <DIV>Here is the latest code:</DIV>
  <DIV># This is the code for a password protected program to store 
  passwords.<BR>password = "hello"<BR>print "The Password Program"<BR>print 
  "Copyright 2005 Nathan Pinno."<BR>print<BR>answer = raw_input("What is the 
  password? ")<BR>while password != answer:<BR>&nbsp;&nbsp;&nbsp; print "The 
  password is incorrect."<BR>&nbsp;&nbsp;&nbsp; answer = raw_input("What is the 
  password? ")<BR>def main_menu_command():<BR>&nbsp;&nbsp;&nbsp; print "1) Add a 
  login info card"<BR>&nbsp;&nbsp;&nbsp; print "2) Lookup a login info 
  card"<BR>&nbsp;&nbsp;&nbsp; print "3) Remove a login info 
  card"<BR>&nbsp;&nbsp;&nbsp; print "4) Print Login info 
  list"<BR>&nbsp;&nbsp;&nbsp; print "5) Save login list"<BR>&nbsp;&nbsp;&nbsp; 
  print "6) Open Login list"<BR>&nbsp;&nbsp;&nbsp; print "9) Exit"</DIV>
  <DIV>&nbsp;</DIV>
  <DIV>def load_login_command(site,filename):<BR>&nbsp;&nbsp;&nbsp; in_file = 
  open(filename,"r")<BR>&nbsp;&nbsp;&nbsp; while 
  1:<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; in_line = 
  in_file.readline()<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if 
  len(in_file) == 
  0:<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  break<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; in_line = 
  in_line[:-1]<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [site,id,passcard] 
  = string.split(in_line,",")<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  list[site] = id and passcard<BR>&nbsp;&nbsp;&nbsp; 
  in_file.close()<BR>&nbsp;&nbsp;&nbsp; <BR>def 
  save_login_command(site,filename):<BR>&nbsp;&nbsp;&nbsp; out_file = 
  open(filename,"w")<BR>&nbsp;&nbsp;&nbsp; for x in 
  site.keys():<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  out_file.write(x+","+sites[x]+"\n")<BR>&nbsp;&nbsp;&nbsp; 
  out_file.close()</DIV>
  <DIV>&nbsp;</DIV>
  <DIV>def add_login_command(site,filename):<BR>&nbsp;&nbsp;&nbsp; print "Add a 
  login info card"<BR>&nbsp;&nbsp;&nbsp; site = raw_input("Site: 
  ")<BR>&nbsp;&nbsp;&nbsp; id = raw_input("User ID: ")<BR>&nbsp;&nbsp;&nbsp; 
  passcard = raw_input("Password: ")<BR>&nbsp;&nbsp;&nbsp; sitelist[site] = 
  [id,passcard]</DIV>
  <DIV>&nbsp;</DIV>
  <DIV>def lookup_login_command(site,filename):<BR>&nbsp;&nbsp;&nbsp; print 
  "Lookup a login info card"<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; site 
  = raw_input("Site: ")<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if 
  sitelist.has_key(site):<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  print "The ID is: 
  ",sitelist[site][0]<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  print "The password is: 
  ",sitelist[site][1]<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  else:<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  print site," was not found."</DIV>
  <DIV>&nbsp;</DIV>
  <DIV>def remove_login_command(site,filename):<BR>&nbsp;&nbsp;&nbsp; print 
  "Remove a login info card"<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; site 
  = raw_input("Site: ")<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if 
  sites.has_key(site):<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  del sitelist[site]<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  else:<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  print site," was not found."</DIV>
  <DIV>&nbsp;</DIV>
  <DIV>def display_login_command(site,filename):<BR>&nbsp;&nbsp;&nbsp; print 
  "Login Info"<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; for x in 
  site.keys():<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  print "Site: ",sitelist," \tID: ",sitelist[site]," \tPassword: 
  ",sitelist[site]<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; print</DIV>
  <DIV>&nbsp;</DIV>
  <DIV><BR>menu_choice = "0"<BR>list = {}<BR>print "Welcome to the second half 
  of the program."<BR>main_menu()<BR>while menu_choice != 
  "9":<BR>&nbsp;&nbsp;&nbsp; menu_choice = raw_input("Choose an option: 
  ")<BR>&nbsp;&nbsp;&nbsp; if menu_choice == 
  "1":<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  add_login_command()<BR>&nbsp;&nbsp;&nbsp; elif menu_choice == 
  "2":<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  lookup_login_command()<BR>&nbsp;&nbsp;&nbsp; elif menu_choice == 
  "3":<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  remove_login_command()<BR>&nbsp;&nbsp;&nbsp; elif menu_choice == 
  "4":<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  display_login_command()<BR>&nbsp;&nbsp;&nbsp; elif menu_choice == 
  "5":<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; filename = 
  raw_input("Filename to save: ")<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  save_login_command()<BR>&nbsp;&nbsp;&nbsp; elif menu_choice == 
  "6":<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; filename = 
  raw_input("Filename to load: ")<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  load_login_command()<BR>print "Have a nice day!"</DIV>
  <DIV>&nbsp;</DIV>
  <DIV>Thanks,</DIV>
  <DIV>Nathan Pinno<BR><A 
  href="http://www.npinnowebsite.ca/">http://www.npinnowebsite.ca/</A></DIV></BLOCKQUOTE>
<P></P></BODY></HTML>