Why the result doesnt appear in my output? - python

I recently started using Python on VScode and I have been having problems with my output.The code runs smoothly(no problems detected) but the result doesnt appear in my output.The problem isnt with my code because even a simple command like print("Hello world") doesnt appear.
Can someone help me?
Here are some screenshots
Also I tried running the program from another terminal but I had to save the file,for exapmple dna.py, and the system wont let me.An error message appears saying it this file is not supported by .ipynb support and the name should match this pattern .ipynd(tried it,still wont accept it)
The code that I created
The image in my ouput after I run the code

I suggest reviewing the official Visual Studio Code Python documentation and tutorial.
Also, try to run the file directly in a terminal and see if it solves your problem.
ex: python my_script.py
See this answer for more details.

Related

Why do I have conda error in VS Code for running a python file?

I've been trying to get used to VS Code, and following their video tutorials.
I followed their debugging video and applied similar thing myself, however I get the following error about conda.
I don't see any print outputs on the screen, nor I can't use the input function in the code.
Is there something that I'm missing or doing wrong?
Thank you.
I couldn't find the reason, but found a solution: changing the interpreter from Anaconda to another one solved the problem for me. In order to change it:
Ctrl+Shift+P for command palette
Search for "Select Interpreter"
Select a working interpreter

Cant run a code in vscode, instead of showing it to me in the terminal section, it sends me to the output section

I'm a noob in computer programming, today i installed vscode to learn python, everything was right, i run short and simple lines of code installed some extensions, but i dont know what happened, I'm not sure if i changed some configuration but when i try to run little lines of code (with the button) instead of running it and showing it to me in the "terminal section", it sends me to the "output" section and it just says that the code already run and its done.
Do somebody knows how to solve it please, it really makes me sad that i just ruined this program because its my first day and this already screw it.
As you can see in the picture, i run the code and it shows off something different in the output section, i wrote that but later changed it. It seem like it runs the file but only when i save it. :(
You must save the file to get the new output everytime.
For running code in Terminal with the button -
It looks like you are using Code Runner vscode extension. Which by default uses Output section to show output and cannot take input. You can change this behavior of that extension by pressing ctrl + , and going into vscode settings. Then just search code runner run in terminal You'll see an option to enable Run in Terminal feature turn that on.

Modifying information displayed in terminal (VSCode)

I have an aesthetic problem with my VSCode terminal. On this picture you can see, that whenever I try to run my code, terminal also displays information about the directory folder. It's annoying and completely useless to me... Is there a way to modify terminal settings, so that this shit is not displayed? After running the code I only want to see the result - in this case words "hellow world".
In some guides I've seen people having it that way, however I can't do it.
System: MacOs; Python 3.X
Thanks in advance!

Build command in sublime text has stopped functioning

I am a new user of Sublime text.
It has been working fine for a few days until it began to refuse to compile anything and I don't know where the problem is. I wrote python programs and pressed cmd+b and nothing happened. When I try to launch repl for this file - that also doesn't work. I haven't installed any plugins and before this issue all has been working well.
Any suggestions on how to identify/fix the problem are greatly appreciated
Yes, you might want to give more detail. Have you made sure you have saved the file as .py? Try something simple like Print "Hello" and then see if this works.

Python "run" and "reload" not showing the changes to my code

I have a simple question. I am in the process of debugging some code. I am using Enthought Python, with the "PyLab" program. I edit my code using gEdit. I am using Ubuntu 10.04.4 LTS.
I use "run myfile.py" to run the program. Then I test myfile(somearguments), and see where the bugs are.
However, when I make changes to the code, using "run myfile.py" again does not properly update what Python/PyLab on the changes to my code. The result is that I will get error messages back pointing to lines that have no errors, and don't even have the "trouble" text in them anymore. I tried using import and reload as well, but that didn't work.
How do I get Python/PyLab to see the new changes to my code? The only option I have for now is to fix the bug and then restart PyLab to confirm the fix.
Thanks!
Did you try to remove the pyc file ?
It may happen as the pyc file exists that PyLab keeps reading it without reloading the file.

Categories

Resources