samedi 14 mars 2015

'str' object is not callable in python


Vote count:

0




I'm calling this function password() in the password() function, hoping that it would start over. Then comes the 'str' object error.


code:



import time

def sleepFor(sleepForInt):
time.sleep(sleepForInt / 1000)

def newScreen(): # adte it says
for itemNew in range(26):
print("\n")

def logo(): # ^~-
newScreen()

print("\t\t\t\tLeigh Studio")
indent(6)

return None

def indent(space): # adte it says
for item in range(space):
print("\n")

def password():
userName = input("Enter registered UserName > ")
user = userName

indent(1)
if userName == "leigh flix":
confirm = input("Confirm UserName (y/n) > ")
indent(2)

if confirm == "y":
password = input("\tenter password ) ")

if password == "comics123":
menu()

else:
print("Password is Incorrect")
sleepFor(2000)
password()
else:
password()
else:
print("No registered UserName as: " + user)
sleepFor(2000)
password()

def printID():
print("C:/users/" + user)

def menu():
response = input(printID())

while response != "quit":

if response == "time":
time.ctime()

def main(): # main method
logo()
sleepFor(1200)
newScreen()

password()


# ___Runs program___
main()


error: enter image description here


I don't know if there talking about the userName = input("Enter registered userName") or something else. oh, btw this is NOT a compile error but a runtime error, if happens when I don't type the right password (which is 'comics123').


The question I am asking Is there a different way of calling the password() function where it doesn't get this error, and or a way to repeat asking for the user if the password is incorrect. Thanks in advance.



asked 30 secs ago







'str' object is not callable in python

Aucun commentaire:

Enregistrer un commentaire