roflol roflol - 1 year ago 85
Ruby Question

Sublime Text 2 console input

I use Sublime Text 2 but it won't let me enter any value when my code asks for user input. (In other words:

in Python and
in Ruby fail to correctly prompt me for input).

Python throws an
error (what you get when user doesn't enter anything).

Simply USER INPUT isn't working in Sublime Text 2 for me.


text = input('Enter something: ')
print text
except EOFError:

=> Enter something: #cannot enter anything to var "text"
=> EOFError
=> [Finished]

Answer Source

Sublime text doesn't support that. But you can get around it (at least in python) by using SublimeREPL, I use this for everything, it works pretty great. Its a little cooky though, as the tab is still editable like a normal sublime tab (which is good and bad)...

It also allows you to run the interpreter in multiple tabs, its basically awesome.

To install it you need package control this lets you easily install plugins. To get it go here, and follow the instructions. Once thats done:

  • in Sublime press ctrl + shift + P (linux command in ST for 'goto anything').
  • Type in 'install',
  • click on 'sublime package control: install package'.
  • Then select SublimeREPL. It will install it automatically.
  • To use it go to Tools>sublimerepl>python from the menus.