Marc 'BlackJack' Rintsch wrote:

> > configfile = file('config.txt', 'w')
> > serverPassword = configfile.readline()

Hrm. When I run the code that I posted I don't seem to get those
errors.

> Please post the exact code you have trouble with.  Don't retype it -- copy
> and paste it.

from getpass import getpass

configfile = file('config.txt', 'w')
serverPassword = configfile.readline()
if serverPassword == '':
   print "Server warning: No password has been set!"
   pwd1 = getpass("New Password: ")
   pwd2 = getpass("Confirm Password: ")
   while pwd1 != pwd2:
       print "Passwords did not match."
       pwd1 = getpass("New Password: ")
       pwd2 = getpass("Confirm Password: ")
   print "Password set. Storing to admin/config..."
   configfile.write(pwd2)
   serverPassword = configfile.readline()
   configfile.close()

Again I tested the code before I posted and I get no errors, just not
the result I am looking for in the text file. Thanks for taking the
time to look at it.

Andrew

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to