Python Forum
Debugger - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: Debugger (/thread-38598.html)



Debugger - azizrasul - Nov-02-2022

I am using PyCharm to run my Python code.

When I place a breakpoint on a line, the whole code runs through to the end? What can I be doing wrong. Note, I am a newbie.


RE: Debugger - deanhystad - Nov-02-2022

Are you running in debug mode? If so, maybe your code is not reaching the breakpoint.


RE: Debugger - azizrasul - Nov-02-2022

I'm running it on Run mode. The breakpoint is on line 7.

import openpyxl
from openpyxl import load_workbook

folder = 'D:/Power BI & Python/'
file = 'Test_Data.xlsx'

wb = openpyxl.load_workbook(folder + file)
wss = wb.sheetnames
ws = wss[0]
wsmaxRow = wb[ws].max_row

print(ws)
print(wsmaxRow)



RE: Debugger - deanhystad - Nov-02-2022

Breakpoints don't work in run mode. You need to run it in debug mode.


RE: Debugger - azizrasul - Nov-02-2022

When I select the Debug tab at the bottom, it automatically jumps to the Run tab!


RE: Debugger - deanhystad - Nov-02-2022

Read this:

https://www.jetbrains.com/help/pycharm/part-1-debugging-python-code.html#start-debugger-session


RE: Debugger - azizrasul - Nov-02-2022

Thanks will repost if I still have an issue.