Sublime Forum

Running Python on sublime console

#1

Hello!

I discovered how to put python to run on console of sublime text 3. but it doesnt run after input. for example:
i wrote:
n=input('Input a number: ')
print n

i run this and it asks for number. i put 100 for example, i hit enter and nothing happens. what am i doing wrong?

1 Like

Python program wont run user input
Build System Python Help
Sublime text editor 3 doesn't through traceback in python code
Input issue in sublime text 3
#2

You didn’t do anything wrong, the console is just not for this purpose. If you want to run python code, you should use a regular python REPL.

0 Likes

#3
0 Likes

#4

As I have mentioned before, the only workaround that I am aware of is to use the package SublimeREPL. Works for me.

1 Like

I get no output w/ ST3 but it's vice versa in NetBeans
#5

I use Console Exec as a general solution.

But I don’t like it always uses xterm as the terminal, I make my own patch, which launch a corresponding terminal depending on user’s desktop environment.

By the way, it seems not to support Mac.

0 Likes

#6

thanks to everyone!
but now there is another problem. i already installed sublime repl. i made a new build system like a youtub tutorial said to, but now it says file not found. i think it is because it doesnt have python path specified. how can i define the path???

0 Likes

#7

SublimeREPL should work out of the box. Just follow the menus from Tools -> Sublime REPL. No build system is required. You don’t mention your OS, but to set the path you go into Environment Variables in Windows.
If you have installed Python, it should have set the path. Make sure that your file has a .py extension and the syntax is set to Python in Sublime Text.

0 Likes

#8

it was slightly complicated, but i managed to get it installed, define path. didnt even use environmental vars.

but now for java:
i already made it to compile and run java (javac and java at the same time)

but i have the same probelm: it does nothing when face with user inputs (scanners in java)

what can i do to solve this on java?
suggests?

0 Likes

#9

i use osx and windows, but atm im trying to make this work on windows. ill try on osx later

0 Likes

#10

 

This works on Windows:

Sublime user input into console (using scanner class with java and running programs in sublime)

 



 
I have a newer solution I started working on last night. It uses PowerShell instead of cmd, and it allows you to put all of your custom builds into one easy to manage file *( aside from your .sublime-build files ). I’ll post when it’s done.

0 Likes

#11

I just posted the script I mentioned in my last post:

##[TEMPLATE] Powershell Script for Multi-Command Builds with Input

0 Likes

#12

i think dev team should add this feature. it would be great!

0 Likes

#13

Como você executa o código Python?

No texto sublime, Build 4143, salve a extensão py.

combinação de teclas [ctrl+shift+b] selecione python,

[ctrl+b], execute o arquivo de seleção como python.

Menu : Tools - > Build with
Menu : Tools - > Build. # execute o arquivo.

0 Likes