Sublime Forum

Output not displaying

#1

Hello,
Please when I type any function in the console, i.e. Print (‘Hello’), nothing shows up. Is there a reason for this. I am new to programming and I will appreciate any help.

Thanks,
K.

0 Likes

#2

Can you provide more details? Which console are you referring to, for example.

0 Likes

#3

Thank you. I’m referring to the sublime text editor page-. The black screen

0 Likes

#4

In order to execute Python code in Sublime you need to save your code in a file with a .py extension and then use Tools > Build to execute it. This also requires that you have installed Python on your operating system if it’s not already installed (i.e. if you use Windows) and that you quit and restart Sublime after installing Python so that it can notice any system changes that might have happened.

0 Likes

#5

This is what I mean. The Print keyword doesn’t show up as a keyword and I am not able to use any key word. Could it be a settings issue?

0 Likes

#6

It’s not going to syntax highlight until you save it into a file with the .py extension so that the editor and external tools know that it’s Python.

0 Likes

#7

Thank you so much. That was very helpful.

The only problem I see is that it’s not displaying the output on the bottom of the screen as expected as attached. Please do you know why?

0 Likes

#8

Did you use the Tools > Build command?

0 Likes

#9

Thank you for your response. No. What I have is attached. Please should I change it?

0 Likes

#10

The Build item in that menu is the one that tries to run the program; you need to choose that one in order to run the program. The build output will appear in a panel at the bottom of the window; the Build Results > Show Build Results will show that panel if you close it or you have set it to not open.

0 Likes

#11

Thank you @OdatNurd. But it is greyed out attached. Please what can I do to enable it?

0 Likes

#12

So what I see is that if I click on build, the program runs and I am able to see the output on the bottom of the screen. But I think I should be able to see the result when I click on the enter key on my computer without having to go to the ‘build’ all the time to run the program.

0 Likes

#13

Maybe I should keep using the shortcut Ctrl B to run my programs, at least that works for me now. Sorry for my dumb questions and thank you for creating time to support me. I appreciate you.

K.

0 Likes

#14

The Build Output item will be grayed out until you run a build for the first time; until then it is disabled because there’s nothing to display.

Indeed you need to press the key to run your program every time you want to run it. The other experience you’re talking about is a REPL ; read-evaluate-print-loop that Python can do to allow you to interactively enter statements and see their results.

If you want to do that, open a command prompt or terminal in your operating system of choice, and then enter python (or if you’re on MacOS, python3) to open the REPL.

0 Likes

#15

Thank you very much @OdatNurd. I’m enjoying what I’m doing so far. I hope it will be fun for a long time :slight_smile:

1 Like