PyCharm, stop the console from clearing every time you run the program - python

So I have just switched over from Spyder to PyCharm. In Spyder, each time you run the program, the console just gets added to, not cleared. This was very useful because I could look through the console to see how my changes to the code were changing the outputs of the program (obviously the console had a maximum length so stuff would get cleared eventually)
However in PyCharm each time I run the program the console is cleared. Surely there must be a way to change this, but I can't find the setting. Thanks.

In Spyder the output is there because you are running iPython.
In PyCharm you can get the same by pressing on View -> Scientific Mode.
Then every time you run you see a the new output and the history there.

Related

Spyder 5.1 - problem with run script button in console

Normally in left corner of IPython console is button to "run script/stop the current command" but in my program it stuck in "stop" form. I can run scripts with F5 or from the toolbar. While the script is running, the script button in console works, and the script can be stopped with it, but the button doesn't change into "run script" afterwards.
I have absolutely no idea what is responsible. I tried to restart Spyder, restart computer, even reinstall Spyder and reset it to factory defaults. Nothing helped.
This is by design in the IDE. Since you could have multiple files running within the same IDE session, the terminal wouldn't know which one you wanted to run at any given point. That's why the run button/shortcut are specific to one file or selection and are on the top bar. The console can only stop the execution of the currently running statement.
If you want to repeat the statement/file you just ran, type %rerun or %rerun N where N is line number of the command you want to rerun. Other options are here: https://ipython.readthedocs.io/en/stable/interactive/magics.html

How to turn off code completion in debugging console in pycharm?

Pycharm code completion is fine in code editor, but rather slow in debugger console. It always hangs for quite a while (up to minutes) after typed in the first letter after a variable of sort (say pandas dataframe).
Is there a way to turn that off in debugger console only? I know it can be turned off completely in settings, but what I want is to turn off in debugger console only, as it works pretty well in code editor.
There's an option in 2018.2 EAP to switch variable loading policy to "On-demand". This should fix the console slowness in the first place:

Why is Python's console split in debug perspective in Eclipse with PyDev?

When I launch my Python program with the debugger in Eclipse with PyDev (Python plug-in for Eclipse), the console is always split into two windows. One where I can actually enter code and the other displays my code entries and their output. See the following snippet.
There is also a "dedicated" debug console which I can start whenever my program is paused, but this requires a manual click (PyDev > Debug Console). This console doesn't have the slip view. See snippet.
Why are there two ways to interact with Python while my program is paused? Why is the default console (from the first screenshot) split into two windows? How can I make my default console be more like the second console without the split view?
The second bottom console keeps a history of user commands that are injected into the current context. It provides a cleaner input mechanism with the ability to navigate through a history of commands. In addition some programs running loops may print to the original console frequently making it difficult to print commands into the top console.
It may have been added for future features as well, like changing the context of the input to a different spot in the code.
That is just my guess. There is a "hide console prompt" terminal button if you do not want to see it. Both consoles can have commands entered in if you are debugging and paused.

.Spyder opens a figure instead of absence of plt.show()

I actually know a problem in Spyder. When I Work with matplotlib.pyplot, it automatically shows the figure without any kind of plt.show(). So when I make many different figures, it always shows them all on the same.
I've recently made a program, which is saving one figure by iteration in an for loop, it also opens a figure and at the end, the loop crashes before ending because of too many figures showed.
I would like to know if someone also knows such problems, because I've encountered the in many computers running spyder
You likely are running in iPython with Spyder. iPython automatically runs plt.show(). Press f6 (default), and see if "execute in current python or iPython console" is selected. If so, check the console, the 'tab' should show a blue icon with "iP" and have 'kernal' (or similar) following it.
Simple fix: switch to "execute in dedicated python console" or open a new python console (tab header "python 1")
Source: had same problem.

Spyder + PythonXY - Python Interpreter and IPython OUTPUT issues - no output

In Spyder (installed together with PythonXY) on a win 8 64 bit machine, both the Python interpreter and the IPython interpreter have output issues.
The first one, gives output at first but as soon as I run some particular code, it doesn't anymore. I noticed the issue happens easily if I get some error messages first, or if I use ipdb, but not only. Even with some code that run smoothly, it happens that it stops giving output afterward.
IPython is opened in a dedicated IPython console tab, although it's kernel opens a window in the console tab (this did not happen to me with previous versions of spyder and it all opened in the console tab). I need to input commands to the interpreter in the IPython console tab window, but the output is sent to the console tab window instead. Very annoying.
Anybody having the same issues? Solutions?
Thanks a lot!
Edit for Carlos Cordoba:
So, for example, in the normal Python interpreter I do:
import module
module.method1(par1)
where method1 has no errors in it. The method works fine and I get the right output. If I try method2 which contains an error, I get no output.
module.method2(par2)
After this, I get no output at all for any code I right. I have to restart the kernel.
I could not reproduce the same behavior right away on the "IPython console" window. It displays the error message correctly and the output keeps coming out correctly. However, if I use ipdb there, the output goes to the Kernel window instead of the console window, which is inconvenient.
Thank you!

Categories