A debugging tool that can help you what happened when you code quits unexpectedly
Project description
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
import wthell
If there's an uncaught exception, you will enter an interactive shell like this:
/home/gaogaotiantian/programs/wthell/test.py(6)
def g(a, b):
a += h(a)
b += 3
> raise Exception("lol")
Exception raised: <class 'Exception'> 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) <func> -- show source code of function <func>
>>>
You will be in the frame(function) that raised exceptions in the beginning.
- Type
upto go to outer frame(its caller). - Type
downto go to inner frame(when you already go out). - Type
clearto clear the console prints - Type
resetto go back to the original frame that triggered wthell - Type
continueto resume the program - Type
show <func_name>to show source code of a function
wthell 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.
>>> a
13
>>> a + 1
14
>>> h(a)
16
>>>
Or you can trigger wthell anywhere in your code
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.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file wthell-0.2.1.tar.gz.
File metadata
- Download URL: wthell-0.2.1.tar.gz
- Upload date:
- Size: 6.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/47.1.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f0569bee6113b13a696f471bd6c2a360f6b9a3c27c014fc8ecc513a12ec14c48
|
|
| MD5 |
208856586e5782bfc67e61397f7fea69
|
|
| BLAKE2b-256 |
a69bb92628f180b807dbddc5108d0c7ea0b469fbacea491397bf97b4af7cd959
|
File details
Details for the file wthell-0.2.1-py3-none-any.whl.
File metadata
- Download URL: wthell-0.2.1-py3-none-any.whl
- Upload date:
- Size: 10.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/47.1.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e38dbff49fc9c4eb33ed2011d2c10fb9f30634c0b55ed5b970286e05e4910f47
|
|
| MD5 |
d36ce6d70ba565d85f508ec251c608a9
|
|
| BLAKE2b-256 |
24e6070251849df66c01046dc7860b641b6dbc8fcf6b2339c4dcb38f7214d0e8
|