Python3.4 Anaconda: Input () function is broken?

I am having problems with the input () function in Python3.4 using the Anaconda integrated editor. If I just type

x = input()

      

into the editor, it returns an empty string that I can enter text into. If I type:

foo

      

into this line, I would expect 'foo' to be stored as a string named x variable. But instead I get:

NameError: name 'foo' is not defined

      

For the function to work properly, I must instead type:

'foo'

      

which is sad because I really want to just pause my code and wait for an arbitrary user input, and I read somewhere that "wait = input ()" is the most pythonic way to do it. Using this line in my actual script returns an "unexpected EOF" error - I'm guessing this is another symptom of the same problem. Can anyone suggest a workaround?

Note. I suspect this is an Anaconda related issue given the following link: https://docs.python.org/3.4/library/functions.html#input

Thank you for your time.

+3


source to share


1 answer


Your code runs Python 2, not 3. I don't know enough about Anaconda to know if there is a problem with their editor, or if your path is confusing, but the problem is the wrong version of Python.



+2


source







All Articles