I use the s=input("") command in a Python 3 script. When I run it from command line (Ubuntu 14.04) and type for example hello I get this error NameError: name 'hello' is not defined. However when I type "Hello" everything is fine. I have seen in other examples that it is not necessary to have the "" in my input. What do I have to change?
Asked
Active
Viewed 313 times
0
-
1possible duplicate https://stackoverflow.com/questions/21122540/input-error-nameerror-name-is-not-defined – yash Dec 02 '17 at 23:38
-
You're probably running Python 2. What specific command are you using to run your script? – anonymoose Dec 03 '17 at 02:10
-
Like others have mentioned, you're probably using Python 2. When you open the terminal to run the script, did you use the command "python" or "python3" – Dec 03 '17 at 03:41
-
yeah that was the problem I did not ran it in my virtual environment where I had the python3. Thank you for your replies – Xantho Dec 03 '17 at 10:23