PyCharm debug console not working

Viewed 12911

I can run the debugger and put breakpoints to active the console but it appears as if the console doesn't pick up the code I am entering.

I can just type anything but I don't get any ouput,

a=2
print(a)
sfgsmk
..g.bbcvdgdggh

Any ideas how I can get the debug console to run the code I am typing and how to get it to show output.

I am using Community Edition 2017.1.4

9 Answers

Adding -s to 'Additional Arguments' in the run configuration helped me with the same issue.

I'm on PyCharm 2019.2 and I had to check the Execution > Run with Python Console checkbox in the Run/Debug Configurations to resolve this issue.

I had the same problem with PyCharm 2020.3 (and earlier versions) under Ubuntu 20.04 with MATE. From the answers and comments it seems that there are multiple possible reasons for this behaviour.

In my case, the debugger console responded at some breakpoints (e.g. near the beginning of the program), but not for others.

What fixed the problem for me is enabling the "Gevent compatible" checkbox the File → Settings → Build, Execution and Deployment → Python Debugger (not "Debugger").

Screenshot of Settings dialog

Relevant YouTrack issue (PY-9372)

I was using pyCharm 2018.1.2 for some time. The debugger was working just fine while all of a sudden it stopped working. I am mentioning this to clarify that mine was working at first. Anyway, there wasn't any change to justify this crack down.

To me, the solution that worked was the File->Invalidate caches/Restart... and then Invalidate and Restart.

Edit:

Although the above solution worked for a while it reverted to the buggy state soon after.

The final (until further notice) solution for me was to remove the old PyCharm folder in my home folder (/home/xxxx/.PyCharmCE2018.1/ in my case) and start a new project. Basically I removed every cache and configuration the PyCharm has used so a let radical solution might also work, like just removing the cache (/home/xxxx/.PyCharmCE2018.1/system/caches in my case)

Do it as @karu mentioned. In pycharm ce 2020, you can add -s in additional Arguments.

  1. From menu, Run -> Edit Configurations
  2. Add -s in to single file or template pytest like the picture

I am using PyCharm 2019.3. What works for me was to go to Edit Run Configuration then uncheck everything under Execution.

Faced the same issue and even tried different PyCharm versions without success.

In the end the reason for debugging console not working was that somewhere in the repo sys.out and sys.stderr were being overwritten.

Related