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

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:

  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

>>> 

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

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.1.1.tar.gz (5.2 kB view details)

Uploaded Source

Built Distribution

wthell-0.1.1-py3-none-any.whl (9.7 kB view details)

Uploaded Python 3

File details

Details for the file wthell-0.1.1.tar.gz.

File metadata

  • Download URL: wthell-0.1.1.tar.gz
  • Upload date:
  • Size: 5.2 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.1.1.tar.gz
Algorithm Hash digest
SHA256 f2c824525ce4c91ad47ebce4595ea35802729540b9015b677545164c7a41924f
MD5 2d16acc51b760e04eb9fdf5b76957c46
BLAKE2b-256 1279be2490ab09ccff1b8d8a0212d958f27054650a8f917b60f5e544b699365c

See more details on using hashes here.

File details

Details for the file wthell-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: wthell-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 9.7 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.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 bddf7566cbcf4f44a63a1abdfa221ec844f1115a699926c10cbbd10892b12591
MD5 72c7a7e3d6c86de35cd9367ea9abbf7e
BLAKE2b-256 ec198e76148835ba1e41d168f8616baac676514f172425185fc4234222a3828d

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