Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Python by (50.2k points)

I am currently using Sublime Text 2 but it won't let me access any value when my program asks for user input.

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

try:

    text = input('Enter something: ')

    print text

except EOFError:

    print('\nEOFError')

=> Enter something: #cannot enter anything to var "text"

=> EOFError

=> [Finished]

1 Answer

0 votes
by (108k points)

See, first of all, the sublime text does not work with input(). You cannot work with that in sublime text. However, you can get nearby it by working with SublimeREPL.

It will help you to execute the interpreter in multiple statements.

To install that module, you just have to install the package control. This lets you easily install plugins. For installing,

  • Go to the Sublime text, there press ctrl + shift + P (Linux command in ST for 'goto anything').
  • There write 'install',
  • Then, select the 'sublime package control: install package'.
  • From that select the SublimeREPL. It will install it automatically.
  • For using that, simply go to Tools>sublimerepl>python from the menus.

If you want to know more about Python basics then do refer to the below Python tutorial that will help you out in a better way: 

Browse Categories

...