How to see the results in IPython Console- Spyder - ipython

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

Related

Coderunner issues Mac

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.

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).

No output when running Python 3 in VScode

I'm using Python 3.8 on VScode, but I can't seem to get the program to write anything in output, even with simple commands like: print("Hello world!"). It shows up in the terminal well enough, so the code shouldn't be the problem. Do i need to fix anything in the setting to make it show the output?
1: Picture of terminal:
Please could you check your user settings.json and workspace settings.json for the existence of a setting for terminal.integrated.shell.*.
I believe you may have changed the shell to use command prompt instead of powershell.
Also, please could you provide some screenshots of the terminal
And any errors logged in the console widows (go to Help->Toggle Developer Tools)

Make eclipse_debug.py work

(In Windows 10, I have installed ...\AppData\Local\Enthought\Canopy that includes Python 2.7, %PATH% points to Canopy)
I have seen this link, and want to make interactively debug Python code running in PyXLL work via that eclipse_debug.py.
So I have done the following:
1) erase PYTHONPATH in the control panel of Windows (as a result, echo %PYTHONPATH% returns %PYTHONPATH%).
2) modify only the first line of eclipse_debug.py to be eclipse_roots = [r"C:\my_path_to\eclipse"].
3) add eclipse_debug.py to pyxll.cfg
4) define a function hello
5) launch debug servier in eclipse, and then launch Excel, and then reload PyXLL
Here is a screenshot:
1) So, it shows that the function hello does work.
2) However, I don't see any excel menu item related to debugger, whereas their link promises This module adds an Excel menu item to attach to the PyDev debugger, and also an Excel macro so that this script can be run outside of Excel and call PyXLL to attach to the PyDev debugger. In other words, I don't see how interactive debug is enabled here.
Could anyone tell me what this eclipse_debug.py supposed to do?
Well, from what I can tell by looking at it, eclipse_debug.py adds the PyDev Remote Debugger (http://www.pydev.org/manual_adv_remote_debugger.html) to the PYTHONPATH and starts it.
Now, how do you make a Python script such as eclipse_debug.py appear as a menu in PyXLL is something I'm not familiar with.
The most likely cause is that it's looking for pydevd but is unable to find it on your python path or where it's looking under the eclipse root. If that's the case there will be some output in the pyxll log file and that will be why the menu item is not appearing.
You should check the log file for errors, and hopefully that will tell you what is going wrong.

How do you get the code in the canopy editor from the ipython console?

Is it possible to get the code in the currently open editor window in the Ipython console? I am interested in running an Ipython magic function that would grab the code in the current window, and send it to a website for analysis, and then show the response in the console. Any ideas?
Not exactly what you are asking for, but maybe the simplest approximation would be to run the ipython magic %history command and copy the output to clipboard.