简体   繁体   中英

Python 3.1 and Sublime Text 2 error

I want to use a SublimeText2 as IDE for developing applications in Python.

I have the following problem :

When I make a new file, save it as a python and do Tools -> Build System -> Python CTRL + B

I get this error:

Please type your name and press enter: Traceback (most recent call last):
  File "/Users/strielok/Desktop/hello.py", line 1, in <module>
    personsname = raw_input("Please type your name and press enter: ")
EOFError: EOF when reading a line
[Finished]

Here is the code of the program:

 personsname = raw_input("Please type your name and press enter: ")
    print "Hello " +personsname

However when I run this code from terminal (I am on Mac), it works perfectly.

Any idea what the problem might be ?

Install sublimeREPL and then choose Tools->sublimerepl->python .

Reference: http://gimo.me/sublime-text2-skills/

Taken from Sublime Text's forums, seems that stdin will not be connected with anything so it's expected.

Source: http://www.sublimetext.com/forum/viewtopic.php?f=3&t=1519&p=6908&hilit=python+input#wrap

I've written a plugin which allows builds in sublime text to take input. It's a bit rough around the edges, but it works on my machine.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM