I\'m running python 2.7.10 on Mac OSX 10.9.5m and it\'s not working. Here\'s the code:
# YourName.py
name = input(\"What is your name?\\n\")
print(\"Hi, \",
use raw_input in python 2.7.1:
name = raw_input("What is your name?\n")
Otherwise you have to rely on the user to know well-enough to input in quoted string. like "David", or the input attempts to evaluate a name (variable/object/etc) and if there is no such name in scope, you'll get the error.
Alternatively, use exception handling:
name = input("What is your name?\n")
try:
print("Hi, ", name)
except NameError, e:
print("Please enclose your input with quotes")