Skip to main content

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 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 <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.

Release files for wthell 0.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for wthell 0.2.1
File Size Uploaded
wthell-0.2.1.tar.gz 6.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for wthell 0.2.1
File Interpreter ABI Platform
wthell-0.2.1-py3-none-any.whl Python 3 none any Details

Total release size: 16.5 kB

Release files / wthell-0.2.1.tar.gz

Download URL wthell-0.2.1.tar.gz
Size 6.3 kB
Tags Source
SHA-256 checksum
How to use checksums
f0569bee6113b13a696f471bd6c2a360f6b9a3c27c014fc8ecc513a12ec14c48
BLAKE2b-256 checksum
How to use checksums
a69bb92628f180b807dbddc5108d0c7ea0b469fbacea491397bf97b4af7cd959
Upload date
Uploaded using Trusted Publishing?
What is 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

Release files / wthell-0.2.1-py3-none-any.whl

Download URL wthell-0.2.1-py3-none-any.whl
Size 10.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e38dbff49fc9c4eb33ed2011d2c10fb9f30634c0b55ed5b970286e05e4910f47
BLAKE2b-256 checksum
How to use checksums
24e6070251849df66c01046dc7860b641b6dbc8fcf6b2339c4dcb38f7214d0e8
Upload date
Uploaded using Trusted Publishing?
What is 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

Release history Release notifications | RSS feed

This release

0.2.1 This release

2 release files

0.2.0

2 release files

0.1.1

2 release files

0.1.0

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page