Avoid multiple console tabs
Answered
Hello,
I've searched the Web and forum and can't find anything.
Is there a way to avoid PyCharm of opening a new console tab after each 'Run'. While developing the code, I end up with hundreds of console tabs which is useless. Ideally, re-running the code would simply display in the existing console, as would Matlab.
With the same idea: when in SciView (Plots) is it possible to avoid adding new plots and just update the one that is currently displayed?
Thank you in advance!
Please sign in to leave a comment.
You are probably looking for Use existing console for "Run with Python Console" in Preferences | Build, Execution, Deployment | Console
That is exactly what I was looking for! Thanks!
Any idea on how to avoid creating new plots, but rather to update the existing plot? I'm using the SciView so the plots I am referring to are the ones that appear on the right-hand side of PyCharm.
Unfortunately, no :(
There is a bug in our issue tracker about that https://youtrack.jetbrains.com/issue/PY-31615
for "updating" plot need jupiter notebook
Hi Sergey,
I have tried the solution you described above with: "Use existing console for "Run with Python Console" in Preferences | Build, Execution, Deployment | Console"...
But it didn't fix the problem. Most of the time when I run a block of code, pycharm continues to open new console windows. Are there other solutions you might be able to recommend?
Thanks
Joemeiser PyCharm shouldn't open a new console if you have "Use existing console..." enabled in Preferences | Build, Execution, Deployment | Console
Perhaps the issue would be more clear if you could record a short screenshot that demonstrates the issue?
Preferences | Build, Execution, Deployment | Console:
Preferences | Keymap (ctrl + enter runs the selected code... This has been working fine for the past six months, but I thought I should mention that I have it set up this way in case it could be contributing to the problem)
Now if I select a block of code in a .py file and press ctrl + enter it sometimes opens in a new console. It doesn't always do this, though. When I just tested it this morning I saw that if I allowed a run of code to fully complete, and then ran some more code, a new console DID NOT open. However, if I pressed the red button to stop code from running, and then ran it again, it DID open a new console.
When you press the stop button, the console is stopped along with the python process. It's impossible to execute more code in the same console, so the new one is opened. Instead of stopping the console, you can stop your code with KeyboardInterrupt (default is Ctrl+C, don't forget to place the focus on the console beforehand).
Thanks for the additional help. I've added some comments in line below.
"When you press the stop button, the console is stopped along with the python process. It's impossible to execute more code in the same console, so the new one is opened."
On my other computer, after I push the stop button I am able to execute more code in the same console. I still don't understand why pycharm is behaving differently on the two computers.
"Instead of stopping the console, you can stop your code with KeyboardInterrupt (default is Ctrl+C, don't forget to place the focus on the console beforehand)."
Ok thanks, I will try this.