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 import it and it's done!

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

back(b)     -- go to outer frame  | in(i)    -- 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 back to go to outer frame(its caller).
  • Type in 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.0.tar.gz (3.9 kB view hashes)

Uploaded Source

Built Distribution

wthell-0.1.0-py3-none-any.whl (8.3 kB view hashes)

Uploaded Python 3

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