question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

`--pdb` support to debug error on task execution

See original GitHub issue

Support post-mortem debugger for unhadled task execution exceptions.

This must handled separately from exceptions on load time. Because doit catches tasks errors and keep running…


(original report)

I’m trying to debug a doit pipeline and need to break into pdb in a library I’m using from doit. Unfortunately, doit captures all in- and output, which I have to undo everywhere I’m trying to debug. Would be nice to have the above mentioned parameter that lets me just do import pdb; pdb.set_trace() (or breakpoint() in the upcoming Python 3.7).

For reference, this is the code I currently use to break into pdb:

try:
    code_that_crashes_somewhere_in_your_pipeline
except KeyError:
    import pdb, sys; 
    d = pdb.Pdb(stdin=sys.__stdin__, stdout=sys.__stdout__)
    d.reset(); t = sys.exc_info()[2]; d.interaction(None, t)

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
schettino72commented, Feb 16, 2018

pytest has the --pdb switch which will launch a pdb shell at the point of the exception

Like this: http://pydoit.org/cmd_run.html#pdb 😁

But this only works to debug issues that happen when loading tasks. Not on task execution… actually I too wished sometimes it would work to debug actual task execution.

0reactions
madigcommented, Feb 16, 2018

I googled “python doit debug” but must embarrassingly admit that I scrolled over your link. Oops.

The snippet I use above has the nice property to break into pdb where the exception occurs without me having to know in advance where exactly it occurs. pytest has the --pdb switch which will launch a pdb shell at the point of the exception (https://docs.pytest.org/en/latest/usage.html#dropping-to-pdb-python-debugger-on-failures). I think that would be useful to have in doit, too.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Advanced Python Debugging with pdb | Codementor
The pdb module can take multiple -c arguments on the command line to execute commands as soon as the debugger starts.
Read more >
Python Debugging With Pdb
In this hands-on tutorial, you'll learn the basics of using pdb, Python's interactive source code debugger. Pdb is a great tool for tracking...
Read more >
How to use the Python debugger (pdb) - Red Hat
Pdb is a powerful tool for finding syntax errors, spelling mistakes, missing code, and other issues in your Python code.
Read more >
Symbol / PDB files in the Visual Studio debugger
The .pdb file holds debugging and project state information that allows incremental linking of a Debug configuration of your app. The Visual ...
Read more >
How to handle script errors that call pdb? - Stack Overflow
I have to include in my overall test flow a script that I have no control over, which initiates python debugger when it...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found