M. Schmidt M. Schmidt - 1 year ago 135
Bash Question

Using the inline Debugger of PyCharm when running a bash-Script (.sh) within the PyCharm Terminal

I wonder if there is any possibility to use the PyCharm inline Debugger when I run a script out of the Terminal.

So I hope to do the following:

  • Set breakpoint in PyCharm Editor

  • Run ./script.sh -options from Terminal

  • When script.sh calls a pyfile.py Python script with the breakpoint in it, it should stop there

  • Giving me the possibility to use the visual debugging features of PyCharm

The above does not work right now. My only chance is to do:

  • import pdb

  • pdb.set_trace()

Then I could work with the pdb - but clearly I don't want to miss the great visual capabilities of the PyCharm Debugger.

I saw that PyCharm uses pydevd instead of pdb. Is there maybe a similar possibility to invoke pydevd and work with the visual debugging then?

Thank you for your help in advance.

Best regards,

Mat Mat
Answer Source

Does the script need to be run from bash? If not you could add a new Python run configuration (Run -> Edit configurations...). This can be run in PyCharms debug mode and will stop at breakpoints defined in the GUI. Rather than having to use set_trace, you can toggle the 'Show Python Prompt' button in console view to get a prompt so you can interact with the programme at the breakpoint.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download