Coderunner issues Mac - visual-studio-code

Please can anyone help me out code runner only shows the right output after running the python file.
For example
Here I used the option "run python file" in terminal and it worked
Then i ran it using coderunner extension and it works
But when i change the output and run it, it doesn't change
It only changes after i run it with python file. So I have to run it in terminal for the right output to show. code runner only mirrors the last output in terminal

This may seem obvious but in the third picture, as you can see from the white circle on the tab where the x to close usually resides indicates that you have not saved the file hence it will output results from the last time you ran it using the 'run python file'. The 'run python file' button saves before running automatically so it would be easy to accidently miss the cause as now its saved with the new input and your code runner will output the new result again making it seem as though its duplicating the 'run python file' button.

Related

Output is not fully displayed on terminal of visual studio code when using "run code" function

When I run the python file with "run code" mode, the output is not fully displayed in the terminal, but when I run the python file with "run python file" mode, the output is fully displayed.
I have set the terminal Integrated scrollback to a much higher number but that didn't fix it. I'm speculating this error is caused by the code runner extension. Hope someone can understand and solve this problem for me.

How to see the results in IPython Console- Spyder

I'm new to spyder and I'm trying to run the code written in the editor but the IPython console isn't showing the results like it's supposed to. All it says is run file and then the file path. I have tried resetting the spyder default settings, restarting the kernel but it doesn't work. so I wrote some code in IPython console and it does work. I don't know where to see the output of my code and I don't know what's wrong.Image
I'm following a tutorial and it's supposed to be like this.Tutorial-Image
(Spyder maintainer here) The problem you're experiencing is caused because Spyder has several evaluation modes. The person in Tutorial-Image is selecting the code in the Editor with the mouse and then running it by pressing the F9 key. That's why you see in that image that the code written in the editor is pasted directly into the console.
In your case case, you're running the code by pressing the Run button (i.e. green play button) or the F5 key. And when do that, you need to add print statements to see its results in the console.
you didn't output anything in your file of code. use the following code to output what you want print
print("hello,world!")
# or
print(a+b) # the a + b was defined in your file of code
EDIT
I installed the spyder and run the code your mentioned.
The following output is

Output is shown on Terminal instead of Output section in VS Code

As you can see, there is no output shown in output section. But the output is shown in terminal tab. Can someone help me in getting the output in output tab instead of Terminal tab ?
that is because you used the code runner extension, am i right? It runs the code by using the command prompt or terminal and run the code with the directory to your file. So if you use code runner extension, it will run the code in the terminal because it uses the terminal.
Your code is indeed supposed to be run from the terminal because you used the code-runner extension. Even though you used another method like running the code from python, it will still be running from the terminal.
Put the following in your settings.json file:
"code-runner.runInTerminal" : true
Courtesy of Code Runner in VSCode is running in output instead of CMD in the Terminal (the opposite question).

What settings do I have to change to make Visual Studio Code automatically run files in the right directory?

Coming from IDLE, I am used to be able to just left-click python files anywhere, it'll launch IDLE, and then pressing F5 just runs the script. In VSCode however, I have to open the terminal, cd into the right directory, and only then can I finally run my python script. Is there a way to change this behavior?
I was recommended to use the Code Runner extention and bound the Run Code (code-runner.run) command to my F5 key.
Then I noticed input() not being ran so I had to make sure code-runner.runInTerminal was on, but that re-started my problem from the beginning because the terminal was at the wrong working directory and then I finally found the code-runner.fileDirectoryAsCwd setting to run it from there.
I think this solution is similar to this one for the python extention, but I'm not sure if that would cause the whole wrong working directory issue again.
choose from menu file then click on auto save

How to Compile and Run Everytime I use CodeRunner in VSCode

I have been using Code Runner extension to build and run c++, python, and java files in Visual Studio Code. But it doesn't actually compile the program every time I run it. It just Run the program. So, If I make any change, The output in the terminal doesn't get updated and doesn't show the changes I have made. The Code Runner just build the program once and that's it. What should I do to make "Code Runner" Build or Compile the program every time I run a program using "Run" or Ctrl+Alt+N?
Got it. Here is what I did to solve the problem.
Go to Extension Settings of Code Runner Find and Mark Save File Before Run.
Screnshot Here
I think I know what you are talking about, Go to the top menu and find performance, inside look for an option something like code runner run in the terminal, check that box and then you can give input to the program.