David Akerele
David Akerele

Reputation: 7

Why am I getting a name Error When I run in sublime Repl?

I don't understand why I am getting these errors and why its not at least running through the second user input prompt. new to sublime. Also are the for loops necessary in the functions. Did I mess up the calls to the functions, or should the logical ordering of the user inputs and functions be different.

Here is the error, Ive also gotten an EOF error.

Traceback (most recent call last):
  File "login.py", line 17, in <module>
    user_name = input("Enter a username ")
  File "<string>", line 1, in <module>
NameError: name 'daY123ytt' is not defined

Here is my code

print ("Welcome please sign up and create a Username and Password")

print ("Password must be 8 characters, have an uppercase and lowercase and a number and special character ")

login = {}

user_name = input("Enter a username ")
pass_word = input("Enter a password ")


def user_signup():
    for x in name:
        if user_name >= len(8):
            print ("user name is too long ")
        elif user_name == pass_word:
            print ("user name is taken")
        else:
            login["Username"]= user_name
        #else append to login dict


import re

def pass_signup():
    for x in pass_word:
        regx = re.compile('!@#$%^&*()<>?/\|{}[];:')
        if (regx.search(string) == None):
            print ("Need Special charcter")
        elif len(pass_word) <= 6:
            print ("Password must be at least 8 characters")
        elif len(pass_word.upper()) < 1 and len(pass_word.lower()) < 1:
            print ("Must have Uppercase and Lowercase characters ")
        else:
            login["Password"]= pass_word
        #else append to login dict:

user_name = input("Enter username")
pass_word = input("Enter password")

def userpass_checker():
    if username == login["Username"] and password == login["Password"]:
        file.open()
    else:
        print ("Try again ")

user_checker()
pass_checker()
userpass_checker()

Upvotes: 1

Views: 64

Answers (1)

sqz
sqz

Reputation: 337

It might be because you are using python2, try replace input with raw_input instead.

Upvotes: 2

Related Questions