Skip to main content

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

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

wthell-0.2.1.tar.gz (6.3 kB view details)

Uploaded Source

Built Distribution

wthell-0.2.1-py3-none-any.whl (10.2 kB view details)

Uploaded Python 3

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

Hashes for wthell-0.2.1.tar.gz
Algorithm Hash digest
SHA256 f0569bee6113b13a696f471bd6c2a360f6b9a3c27c014fc8ecc513a12ec14c48
MD5 208856586e5782bfc67e61397f7fea69
BLAKE2b-256 a69bb92628f180b807dbddc5108d0c7ea0b469fbacea491397bf97b4af7cd959

See more details on using hashes here.

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

Hashes for wthell-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 e38dbff49fc9c4eb33ed2011d2c10fb9f30634c0b55ed5b970286e05e4910f47
MD5 d36ce6d70ba565d85f508ec251c608a9
BLAKE2b-256 24e6070251849df66c01046dc7860b641b6dbc8fcf6b2339c4dcb38f7214d0e8

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page