I am a newbie in sublime text and having problems executing code having
user input. While the editor does ask for the user input,it does not execute
the rest of the code after the input.
Any help will be appreciated.
User input
Build broken? - Python 3 - input()
I can not continue
Ghost error running "try except"test
Sorry deathaxe, but how do I find the answer to the previous thread " Py program not running after user input?".
My code for the program:
a = int(input("Input an integer : "))
n1 = int( “%s” % a )
n2 = int( “%s%s” % (a,a) )
n3 = int( “%s%s%s” % (a,a,a) )
print (n1+n2+n3) .
After I input 5, sublime does not execute the code!!
Sorry for the bother.
The answer is quite simple:
To run ordinary python code, you need an external (standalone) python interpreter. This interpreter would normally be called via build system (ctrl+b). The default build system of ST is made to run full automated build scripts which at most print some content to a console. Hence it does not provide any interface to send interactive user input to the backend (python in your case).
This is what you need an terminal for. The terminus plugin does exactly that. It can start an interactive console session within a ST view or a panel. It can act as alternative build system to run your open file with the correct interpreter backend allowing full user interaction (input and output).
You can’t use ST’s internal python interpreter to run ordinary scripts with console I/O. It is meant to drive the plugin infrastructure only.