input() error – NameError: name ‘…’ is not defined

I am getting an error when I try to run this simple script:

input_variable = input("Enter your name: ")
print("your name is" + input_variable)

Let’s say I type in “dude”, the error I am getting is:

  line 1, in <module>
    input_variable = input("Enter your name: ")
  File "<string>", line 1, in <module>
NameError: name 'dude' is not defined

I am running Mac OS X 10.9.1 and I am using the Python Launcher app that came with the install of Python 3.3 to run the script.

15 Answers
15

Leave a Comment