Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/gaogaotiantian/wthell
wthell is a debugging tool for python to interactively check frame stack when your code quit unexpectedly
https://github.com/gaogaotiantian/wthell
debugging debugging-tools python traceback
Last synced: 26 days ago
JSON representation
wthell is a debugging tool for python to interactively check frame stack when your code quit unexpectedly
- Host: GitHub
- URL: https://github.com/gaogaotiantian/wthell
- Owner: gaogaotiantian
- License: apache-2.0
- Created: 2020-09-01T22:30:21.000Z (about 4 years ago)
- Default Branch: master
- Last Pushed: 2023-05-28T15:14:14.000Z (over 1 year ago)
- Last Synced: 2024-10-07T19:41:14.659Z (about 1 month ago)
- Topics: debugging, debugging-tools, python, traceback
- Language: Python
- Homepage:
- Size: 30.3 KB
- Stars: 37
- Watchers: 3
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# wthell
wthell is a debugging tool for python to interactively check frame stack when your code did something unexpectedly
## Install
You can install ```wthell``` from pip
```
pip install wthell
```## Usage
It's super easy to use wthell. Just run you script using wthell instead of python
```
wthell your_script.py args1 args2
```In linux shell, you can simply use this right after you command failed:
```
wthell !!
```Fun, isn't it?
Or you can import wthell in your script and run your script normally
```python
import wthell
```If there's an uncaught exception, you will enter an interactive shell like this:
```python
/home/gaogaotiantian/programs/wthell/test.py(6)
def g(a, b):
a += h(a)
b += 3
> raise Exception("lol")Exception raised: lol
up(u) -- go to outer frame | down(d) -- go to inner frame
clear(cl) -- clear the console | reset(r) -- back to trigger frame
continue(c) -- resume the program | ctrl+D -- quit
show(s) -- show source code of function>>>
```You will be in the frame(function) that raised exceptions in the beginning.
* Type ```up``` to go to outer frame(its caller).
* Type ```down``` to go to inner frame(when you already go out).
* Type ```clear``` to clear the console prints
* Type ```reset``` to go back to the original frame that triggered wthell
* Type ```continue``` to resume the program
* Type ```show ``` to show source code of a functionwthell will record the full call stack so you can check any frame.
While you are in a stack, you can type anything that you want to evaluation to help you debug.
```python
>>> a
13
>>> a + 1
14
>>> h(a)
16
>>>
```Or you can trigger wthell anywhere in your code
```python
def suspicious_function():
# I want to check here!
wthell.wth()
```wthell behaves like an interactive shell.
Happy debugging!
## License
Copyright Tian Gao, 2020.
Distributed under the terms of the [Apache 2.0 license](https://github.com/gaogaotiantian/wthell/blob/master/LICENSE).