Set Breakpoints in PyCharm

Question:

I’m using pyCharm for the first time today. I’m running a very simple program and I’m trying to set a breakpoint. I can’t set a breakpoint no matter what I do, and it seems like almost everything under the Run menu is greyed out. Is this feature disabled in the Community version of PyCharm? This seems like a very desirable feature to have access to, but everything on my system seems to be shut off? Even when I Google for solutions, I get lots of hits, but none of the recommendations actually works for me. Any thoughts?

enter image description here
enter image description here

Asked By: ASH

||

Answers:

You can add the breakpoint by just clicking on the left hand side next to the line number. And then click on Run -> Debug Have you tried it already?Check attached image

Answered By: Ashok KS

Let Pycharm recognize your file as .py file, by editing filename to scratch.py.
There is highly chance that Pycharm doesn’t recognize the file type, then it can’t correctly configure an interpreter for it. If rename doesn’t work, try to manually set the configuration, (in this pic is the dropdown arrow near preprocess) here

Answered By: enamoria

One caveat that caused me a lot of headache was that a breakpoint needs to be on a line with executable code. I was trying to set a breakpoint on a blank line before the statement where I wanted to check a variable’s value. Everything was greyed out because the cursor was not on an executable line of code. Move the cursor to the next executable line after the point where you want to check the state and try to set a breakpoint there.

Answered By: John Redford

It is not that comfortable as the red dot, but you can add breakpoint() to your code,but it will also stop in normal mode

Answered By: AndiB

Reinstalling the pycharm will fix the issue

Answered By: Bindu B C
Categories: questions Tags: ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.