0

I installed a Python package and would like to debug it using PyCharm. Typically I can simply set breakpoints and debugging works fine. However, the package (let's call it module_name) I am using now has to be called from the terminal, or in a Python script using os.system("module_name --additional_args"). It runs fine like this, but if I put a breakpoint in module_name.py at entry_func():

def get_parser():
...

def entry_func(args=None):
...

if __name__ == "__main__":
    entry_func()

The breakpoint is ignored. Why is that? And how can I debug this module otherwise?

I tried to set a breakpoint at entry_func(), but the program did not stop there.

8
  • 3
    Breakpoints are meant to be used with your editor (or debugging program), not directly from terminal using the python interpreter. Commented Aug 18, 2023 at 9:28
  • Checkout this: jetbrains.com/help/pycharm/… Commented Aug 18, 2023 at 9:29
  • Thanks, the debugger works fine otherwise. So that is not the issue. 'Breakpoints are meant to be used with your editor (or debugging program), not directly from terminal using the python interpreter.' Ok, so how can I debug this code? Commented Aug 18, 2023 at 9:32
  • Can I somehow run the package in a different way such that I CAN use the debugger? Commented Aug 18, 2023 at 9:33
  • You can run it via pdb to use a terminal-based debugger. PyCharm and others use it internally Commented Aug 18, 2023 at 9:35

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.