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?
Answers:
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
)
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.
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
Reinstalling the pycharm will fix the issue
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?
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
)
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.
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
Reinstalling the pycharm will fix the issue