automain not compatible with PDB / PUDB debuggers
See original GitHub issuePhenomenon
When I write the script with automain
and run it with $ python -m pdb script.py
,the debugger does not open the post-mortem analyzer even if there is an error.
Why this may be an issue
Without using automain, the use of python <scriptname.py> with ‘param=“value”’ seems to be restricted.
MnWE (minimal not-working example)
from sacred import Experiment
ex = Experiment()
@ex.automain
def main():
raise Exception()
Run this with
$ python -m pdb <scriptname.py>
and you can observe that the PDB does not start.
MWE (minimal working example)
from sacred import Experiment
ex = Experiment()
@ex.main
def main():
raise Exception()
if __name__ == '__main__':
ex.run()
Run this with
$ python -m pdb <scriptname.py>
and you can observe that the PDB starts.
Issue Analytics
- State:
- Created 5 years ago
- Comments:5
Top Results From Across the Web
Visual debugging in Python with PDB and Rapunzel - YouTube
https://www.buymeacoffee.com/cogsci] In this video, I show how to use PDB, the standard Python Debugger, and Rapunzel, a code editor, ...
Read more >Debugging - DroneKit-Python
The Python Debugger - pdb can be used to debug DroneKit-Python apps. ... a IDE like debug you can use pudb - A...
Read more >Debugger - Features | PyCharm - JetBrains
Debug Your Python Code with PyCharm. Visual Debugging. Some coders still debug using print statements, because the concept is hard and pdb ......
Read more >Debugging Cloudify Workers
Cloudify does not use anymore celery for running executions but for sake of backward compatibility we still install it in the environment.
Read more >Awesome Python
Debugging Tools. Libraries for debugging code. pdb-like Debugger. ipdb - IPython-enabled pdb. pdb++ - Another drop-in replacement for pdb. pudb - A ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Hi @diadochos, This questions seems to pop up rather regularly. It is due to the default stacktrace filtering sacred does to remove the internal clutter due to decorated functions. You can disable this with with the
--debug
/-d
flag. FYI: you can also use the-D
flag to attach a post-mortem debugger. See debugging section in the docs.Maybe the documentation about debugging should be more prominent / extensive. What do you think? Would a top-level debugging section have helped you?
For the sake of clarity, to disable Sacred stacktrace filtering you run this:
python -m pdb <scriptname.py> -d
orpython -m pdb <scriptname.py> --debug
And to add a post-mortem debugger you run this:
python -m pdb <scriptname.py> -D
orpython -m pdb <scriptname.py> --pdb
As specified in the CLI guide in the docs