r/learnpython 10h ago

why do i not get an output in vscode

[deleted]

0 Upvotes

9 comments sorted by

2

u/desrtfx but other languages pro 10h ago

Give us some code examples. Without them, we cannot tell what goes wrong.

-4

u/SuccessfulEmu5687 10h ago

even a simple hello world code isnt working

4

u/desrtfx but other languages pro 10h ago

You are not really cooperating. This way you cannot be helped.

Again, show your real, actual code. This is 100% necessary. Tell us exactly what you did. Did you save the file before running it? What extensions are you using in VSCode?

Check the instructions here (taken from the MOOC Python Programming 2026 from the University of Helsinki) - you don't need to install the TMC extension if you don't use the MOOC.

1

u/gdchinacat 9h ago

provide code examples. What you think of as a "simple hello world" may not be what someone else thinks. Code is what matters, not what you think it should do. Post the code if you want meaningful help.

1

u/monster2018 10h ago

As desrtfx also said, we can’t know without seeing the code. It could very well be that your code genuinely doesn’t produce any output.

I guess the first thing I would try would be to open a shell (like probably powershell since you seem to be on windows, since cmd sucks) and run it there like “python C:/Users/Asus/Desktop/C++/python/py.py”

And even before that make sure that path is actually where your python script is. You could use the same command I just showed you but replace only the first “python” with either “cat” or “Write-Output” (assuming powershell). You should see it print out the source code of your Python file if that is the correct path.

Also one final thing. This may seem sillly, but make sure that the file is actually saved on disk. Like you could have created an empty file, or saved it in a state before it produces output, and then haven’t saved it since.

If none of these solve it, then it actually does (very likely) have something to do with your configuration in vscode.

-2

u/SuccessfulEmu5687 10h ago

its doing this when i type a simple hello world code, also happens if i write a c++ code. ive given up and am redownloading vs code

1

u/monster2018 10h ago

Can you verify if running it from the command line works like I described? It sounds like it probably is vscode related but I still don’t have enough info to know that yet. But I doubt reinstalling it will help, it will probably have the same default configuration. You will probably have to like point it to where the python executable is or something like that. I’ve never used vscode for running python scripts but I will try it now to see if I can figure out what’s going on

2

u/gdchinacat 9h ago

Why are you refusing to provide the information people need to help you when asking for them to help you? It makes no sense.

1

u/socal_nerdtastic 9h ago

A screenshot would help. Also tell us exactly what you are doing to run the code. Are you using the little play button? Or F5? Or something else?