while getting the user input ex. a=input("Enter the number or string ") when i execute this statement it takes to me an infinite loop after which nothing is executed in the sublime. which setting or features i need to embed into sublime for getting the input?
Asked
Active
Viewed 1.1k times
3 Answers
0
install SublimeREPL (documentation on how to install it on the github link) to use it :
go to : Tools>SublimeREPL>Python>Python - RUN current file

Hani Yassine
- 31
- 5
0
Sublime-text doesn't allow users to give input to the program but you can make a new Python build system to allow you to give input.
- Go to Tools>>Build System>>New Build System
- Paste the below code in the file and Save the file.
-
{
"shell_cmd": "gnome-terminal -- bash -c \"python3 -u $file;echo;echo Press Enter to exit...;read\"",
"file_regex": "^[ ]*File \"(...*?)\", line ([0-9]*)",
"selector": "source.python",
}
Save the file and Select build using Ctrl+Shift+B
When you will execute your program using Ctrl+B this will run the program in a terminal and where will be able to give input.

Raghav
- 1
- 3
0
You can try this also. It will work well.
- Go to Tools>>Build System>>New Build System
- Paste it
{
"file_regex": "^\\s*File \"(...*?)\", line ([0-9]*)",
"working_dir": "${file_path}",
"shell": true,
"selector": "source.py,source.pyhton",
"shell_cmd": "gnome-terminal -- bash -c 'python3 $file;echo;echo -e \"\\e[107m \\e[92m \\e[1m \\e[5mPress ENTER to continue\";read line;exit'", // for gnome-terminal
}
Let, you will save the file python3.sublime-build. So, after saving you can see the option
- Tools>>Build Systems>>python3
So, mark it and just press Ctrl+B every time.
And enjoy !!!!!!!!