<!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><LABEL id=HbSession SessionId="3115638135"></LABEL>
<DIV>Hi all,</DIV>
<DIV> </DIV>
<DIV>Here's one of the messages that pops up:</DIV>
<DIV> </DIV>
<DIV>Traceback (most recent call last):<BR> File "D:\password.py", line
77, in ?<BR> filename == raw_input("Filename to load:
")<BR>NameError: name 'filename' is not defined</DIV>
<DIV> </DIV>
<DIV>Why is it popping up whenever I try to load a file?</DIV>
<DIV> </DIV>
<DIV>Here's the latest code:</DIV>
<DIV> </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> print "The
password is incorrect."<BR> answer = raw_input("What is the
password? ")<BR>def main_menu():<BR> print "1) Add a login
info card"<BR> print "2) Lookup a login info
card"<BR> print "3) Remove a login info
card"<BR> print "4) Print Login info
list"<BR> print "5) Save login list"<BR>
print "6) Open Login list"<BR> print "9) Exit"</DIV>
<DIV> </DIV>
<DIV>def load_login(site,filename):<BR> in_file =
open(filename,"r")<BR> while
1:<BR> in_line =
in_file.readline()<BR> if len(in_file)
== 0:<BR>
break<BR> in_line =
in_line[:-1]<BR> [site,id,passcard] =
string.split(in_line,",")<BR>
list[site] = id and passcard<BR>
in_file.close()<BR> <BR>def
save_login(site,filename):<BR> out_file =
open(filename,"w")<BR> for x in
site.keys():<BR>
out_file.write(x+","+sites[x]+"\n")<BR>
out_file.close()<BR> <BR>menu_choice = "0"<BR>list =
{}<BR>print "Welcome to the second half of the program."<BR>print
main_menu()<BR>while menu_choice != "9":<BR> menu_choice =
raw_input("Choose an option: ")<BR> if menu_choice ==
"1":<BR> print "Add a login info
card"<BR> site = raw_input("Site:
")<BR> id = raw_input("User ID:
")<BR> passcard = raw_input("Password:
")<BR> list[site] = id and
passcard<BR> menu_choice =
raw_input("Choose an option: ")<BR> elif menu_choice ==
"2":<BR> print "Lookup a login info
card"<BR> site = raw_input("Site:
")<BR> if
site.has_key(site):<BR>
print "The ID is:
",id(site)<BR>
print "The password is:
",passcard(site)<BR>
else:<BR>
print site," was not found."<BR>
menu_choice = raw_input("Choose an option: ")<BR> elif
menu_choice == "3":<BR> print "Remove
a login info card"<BR> site =
raw_input("Site: ")<BR> if
sites.has_key(site):<BR>
del numbers[site]<BR>
else:<BR>
print site," was not found."<BR>
menu_choice = raw_input("Choose an option: ")<BR> elif
menu_choice == "4":<BR> print "Login
Info"<BR> for x in
site.keys():<BR>
print "Site: ",x," \tID: ",numbers[x]," \tPassword:
",numbers[x]<BR>
print<BR> menu_choice =
raw_input("Choose an option: ")<BR> elif menu_choice ==
"5":<BR> filename =
raw_input("Filename to save: ")<BR>
save_login(list,filename)<BR>
menu_choice = raw_input("Choose an option: ")<BR> elif
menu_choice == "6":<BR> filename ==
raw_input("Filename to load: ")<BR>
load_login(list,filename)<BR>
menu_choice = raw_input("Choose an option: ")<BR>print "Have a nice day!"</DIV>
<DIV> </DIV>
<DIV>Anything else that needs addressing?</DIV>
<DIV> </DIV>
<DIV>Thanks,</DIV>
<DIV>Nathan Pinno<BR><A
href="http://www.npinnowebsite.ca/">http://www.npinnowebsite.ca/</A></DIV>
<P></P></BODY></HTML>