Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def getnewpassword(tempname):
- passwordPassed = False
- passwordComplete = False
- newpassword = raw_input('Please enter a password for ' + tempname + '.' + ' Please note that you cannot use spaces when creating a password.\n')
- #makes sure there are no spaces in password.
- if ' ' in newpassword:
- print 'Sorry but your password has a space in it. Remember, you cannot have spaces in your password. Try again.\n'
- getnewpassword(tempname)
- passwordPassed = False
- else:
- print "Password accepted.\n"
- passwordPassed = True
- #asks for password input again and checks to see if both password variables match.
- if passwordPassed == True:
- retypedpassword = raw_input('Please enter your password again.\n')
- if newpassword == retypedpassword:
- print "User account created."
- setuserpassword = retypedpassword
- passwordComplete = True
- else:
- print "passwords don't match. Please try again"
- getnewpassword(tempname)
- #attempts to write password after username: Works but gives an IO error.
- if passwordComplete == True:
- settingpassword = open('accounts.txt','r+')
- for line in settingpassword:
- if tempname in line:
- settingpassword.write(setuserpassword + '\n')
- settingpassword.close()
- IO Error is
- Traceback (most recent call last):
- File "path crap", line 72, in getnewpassword
- for line in settingpassword:
- ValueError: I/O operation on closed file
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement