0
votes

I am learning python via codeacademy's python syntax tutorial but when I run the same working code in SublimeText2 the code does not build properly. I have version 2.7 of Python installed on my mac for the record.

original = raw_input('Enter a word:')
print original

I am wondering why this code would work in codeacademy's syntax lesson but not work in my text editor. The error produced occurs immediately upon running the code. The user is given no chance to respond to the prompt.

Traceback (most recent call last):
File "/Users/Tom/Documents/firstsublimeentry.py", line 1, in <module>
original = raw_input('Enter a word:')
EOFError: EOF when reading a line
Enter a word:[Finished in 0.0s with exit code 1]
1
Does it fail when you run it in Python, or just when you try to run it through some REPL that SublimeText offers? Probably better to just save it in a mycodehere.py file and run python mycodehere.py from your Terminal. - Adam Smith
Are you copy-pasting from the web? Try starting with a blank text doc and type out the whole code again - double_j
I already tried not copy-pasting it from the web. I started with a blank text doc and typed out the whole code again. - Bodhidarma
And no I'm not using an REPL. - Bodhidarma

1 Answers

3
votes

Sublime Text's console is not able to capture input. To execute your code, either use a python shell, execute it from the command line, or install the Sublime Package SublimeREPL via Package Control.