0

We write python test scripts with long run times, so we try to enable our scripts to handle errors that arise automatically and proceed. I have to include in my overall test flow a script that I have no control over, which initiates python debugger when it hits an error. This results in the whole test script halting to wait for user input.

Is there a way to call a script that prevents it from falling into pdb when it hits an error, even if that script is trying to engage the debugger?

m100psi
  • 43
  • 3
  • you can use, `try ... except` this is a simple tutorial for that. https://www.w3schools.com/python/python_try_except.asp – Marya Mar 03 '22 at 20:50
  • 1
    https://stackoverflow.com/questions/46166539/how-to-disable-pdb-set-trace-without-stopping-python-program-and-edit-the-code has a few options that you can try. – Tathagata Mar 03 '22 at 20:54
  • As far as I know, I can't use a try/except loop to prevent the script I'm calling from calling pdb.set_trace() within their own error handling. Is there something specific you're thinking of? – m100psi Mar 04 '22 at 00:52
  • Regarding the other thread, `os.environ["PYTHONBREAKPOINT"] = "0"` didn't have any impact. Guessing this only helps if the script is using breakpoint() to call pdb. After installing pdb++, `pdb.disable()` worked in a small test function, but it doesn't work for my actual application. Now when it halts it just shows _(Pdb++)_ instead of _(pdb)_. So maybe the script I'm trying to handle is using something other than just `pdb.set_trace()`. – m100psi Mar 04 '22 at 01:24

0 Answers0