Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kwang2049/crash-ipdb
Debug Python crashes conveniently: Whenever a Python code crashes, the ipdb debugger will be triggered.
https://github.com/kwang2049/crash-ipdb
debugger ipdb ipython pdb python
Last synced: 24 days ago
JSON representation
Debug Python crashes conveniently: Whenever a Python code crashes, the ipdb debugger will be triggered.
- Host: GitHub
- URL: https://github.com/kwang2049/crash-ipdb
- Owner: kwang2049
- Created: 2021-12-17T00:05:04.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2022-10-14T22:15:35.000Z (about 2 years ago)
- Last Synced: 2024-09-29T18:40:11.878Z (about 1 month ago)
- Topics: debugger, ipdb, ipython, pdb, python
- Language: Python
- Homepage:
- Size: 4.88 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# crash-ipdb
Debug Python crashes conveniently: Whenever a Python code crashes, the [ipdb](https://github.com/gotcha/ipdb) (IPython debugger) debugger will be triggered. And the [pdb](https://docs.python.org/3/library/pdb.html) commands can be used to debug your crash.## Usage
First install it with:
```bash
pip install crash-ipdb
```
Then import `crash_ipdb` in your Python and run your code as usual ([./example.py](example.py)):
```python
import crash_ipdb # just import crash_ipdb in your Python code## simple example of source code to be debugged ##
x = 1
y = 0print(x/y) # When you see '----> 7 print(x/y)', this will mean you have entered the ipdb, stopping at this line
```
You will find you have entered into ipdb and can use the [pdb commands](https://docs.python.org/3/library/pdb.html) to debug your code:
```bash
Traceback (most recent call last):
File "example.py", line 7, in
print(x/y) # When you see '----> 7 print(x/y)', this will mean you have entered the ipdb, stopping at this line
ZeroDivisionError: division by zero> /home/ukp/kwang/crash-ipdb/crash-ipdb/example.py(7)()
3 ## simple example of source code to be debugged ##
4 x = 1
5 y = 0
6
----> 7 print(x/y) # When you see '----> 7 print(x/y)', this will mean you have entered the ipdb, stopping at this line
```## Reference
[xcodebuild/crash_on_ipy.py](https://gist.github.com/xcodebuild/3fef2c1e6eb109a91977)