问题
I'd like to set up Sublime Text 2 (or 3 if recommended) to allow user input (raw_input() or input() within the files.). To clarify, I've had this work before! I want to be able to write and execute all code within one window/tab. I have installed sublimeREPL correctly but yet whenever I use either raw_input() or input() I receive the following error:
EOFERROR: EOF when reading a line
I've had it setup correctly and it worked perfectly before, but it's been a long time and I cannot reproduce the steps anymore. Any help would be appreciated.
To summarize, this works:
print "This is a test"
This will not work: (this has worked previously on my home desktop)
print "This is a test"
testvar = raw_input("enter a number: ")
print testvar
Please let me know if there's anything I can do. Thank you so much in advance, sectas
回答1:
I think the problem is that you are using the the default build system (Ctrl + B)
If so, open in REPL by:
Tools > SublimeREPL > Python > Python
If you receive a FileNotFoundError, change the SublimeREPL Settings(USER) to:
{
"default_extend_env": {
"PATH": "{PATH}:YourDriveLetter:\\YourPath\\Python27\\App\\python.exe"
}
}
来源:https://stackoverflow.com/questions/18921864/sublime-text-2-sublimerepl-allowing-user-input