Sublime Forum

No output despite the simple print command

#1

I have just started getting into coding and wanted to set up sublime text to code on. I have a terminal open in the background and have downloaded python on my Mac. When I put a simple code such as print(“Hello”) into the terminal it works perfectly, but the problem arises when it comes to the output on sublime text. I created a new build system where I put in the code
“{
“cmd”:[“python3” “-u” “$file”],
}”
I then created a new file on sublime text where I tried entering a simple command like print(“Hello”), and on the bottom left it said Building… yet showed no output and after a moment or two it disappeared. For some context I have scoured the internet and technical support forums for solutions to this problem yet none have worked. My build system is on python. I have enabled show build results and do see the popup where the output should show up. I have also renamed the file to end in .py and when I switch back to the file where I put the command “cmd”:[“python3” “-u” “$file”], and press build the output shows finished in 63ms or such. But when I switch back to the file where I want it to print hello, it still doesn’t give any sort of output.

What could be the reason for this issue?
P.S. I have tried to be as specific as possible because I HAVE tried a bunch of different solutions. None of which have worked.

0 Likes

#2

Does the content of your build system file include those " characters you posted above? If so, the reason it doesn’t work is because that’s not a valid JSON object, so Sublime can’t use it to build.

However that said, there’s no reason that you can’t just use the Python build that ships directly with Sublime by default to run Python code. If you are following a book or blog post that told you that you needed to make your own build, it was incorrect.

0 Likes

#3

Thank you for your reply and to clear things up, I was following the Python Crash Course book which instructed me to go to tools and create a new Build system. it looks like this


the file Hello_World.py is the one that does not provide an output and the build system for that is selected as python

0 Likes

#4

For your simple program, write your line of code; press enter;
save your program in documents folder with a .py extension or anywhere but the ST folder.
Then reload Sublime Text, open your program, press CTRL-SHIFT-B, choose Python from the popup menu and you will see “hello world” in the console below.

0 Likes

#5

I tried all the things you mentioned in order but still did not receive the output. Honestly I have no idea what is the problem as it is very strange. Do you have any other suggestions as to why I may be having issues? As I would very much like to start coding.

0 Likes

#6

Are you sure you haven’t selected the “syntax check” variant of the default python build system?

0 Likes

#7

Yes I’m sure, and even if I had it would say finished in … ms. But it just doesn’t provide any sort of output.

0 Likes

#8

Is Python installed? I see that it is installed. Is it on the PATH?

0 Likes

#9

Does running python3 -u Hello_World.py work?

0 Likes

#10

Could you please elaborate what you mean by " Does running python3 -u Hello_World.py work?", because I’m not sure I understand.

0 Likes

#11

And what exactly is the PATH? I have not heard of the term before.

0 Likes

#12

If you open up a terminal, cd into the directory containing Hello_World.py and then run python3 -u Hello_World.py in the terminal does that work as expected?

0 Likes

#13

I ran it and I think it did something but I’m not sure what exactly was supposed to happen. I am still not getting any output. This is what it said on the terminal

What’s wierd is that now the Hello_World.py file on sublime text has a red dot by it instead of a green one.

0 Likes

#14

A red dot means the file was deleted - it doesn’t exist on disk anymore. Given that it works in the terminal, if you open that same file in Sublime Text and run the default python build system it should work. If it still doesn’t work for you I suggest recording a video so we might better see what’s going wrong.

0 Likes

#15

It worked!!! Thank you so much for all of your help I am thrilled to be able to finally start learning to code!

0 Likes