• Stars
    star
    144
  • Rank 255,590 (Top 6 %)
  • Language
    Python
  • License
    MIT License
  • Created over 3 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Automatically find solutions when your Python code encounters an issue.

PyPI - License PyPI - Python Version PyPI - Status PyPI PyPI - Wheel PyPI - Downloads Discord

Logo

What the Python?!

Find solutions to your Python errors without leaving your IDE or terminal!

Ever have Python throw an error traceback longer than a CVS receipt 🧾? Is it dizzying to read through a bunch of cryptic lines trying to figure out exactly what caused the error? Do you look at the traceback and go, "WHAT THE ....."?πŸ˜•

What the Python (wtpython) is a simple terminal user interface that allows you to explore relevant answers on StackOverflow without leaving your terminal or IDE. When you get an error, all you have to do is swap python for wtpython. When your code hits an error, you'll see a textual interface for exploring relevant answers allowing you to stay focused and ship faster! πŸš€

wtpython is styled using Rich and the interface is developed using Textual.

Like what you see? Feel free to share #wtpython on social media!

Installation

This project is hosted on PyPI, allowing you to install it with pip.

pip install wtpython

Usage

When you're coding and running your script or application, then all of a sudden, you see an error and think to yourself "what the...?"

$ python example/division_by_zero_error.py
Traceback (most recent call last):
  File "/home/cohan/github/what-the-python/wtpython/example/division_by_zero_error.py", line 1, in <module>
    1 / 0
ZeroDivisionError: division by zero

All you have to do is jump to the beginning of the line and change python to wtpython and the magic will happen.

$ wtpython example/division_by_zero_error.py
# Magic! 🎩

usage

If you want results but don't want to go into the interface, just pass the -n flag to see the Rich formatted traceback and links to the most relevant questions on StackOverflow.

no-display-usage

If you want, you can always run wtpython in place of python. wtpython is designed to allow your code to function normally and only acts when your code hits an error. wtpython will even allow you to pass arguments to your own script! If our code hits an error, please let us know.

Command Line Options

All command line options should be passed before your script and arguments passed to your script.

Flag Action
-n or --no-display Do not enter the interactive session, just print the error and give me the links!
-c or --copy-error Add the error message to your clipboard so you can look for answers yourself (it's okay, we understand).
--clear-cache wtpython will cache results of each error message for up to a day. This helps prevent you from getting throttled by the StackOverflow API.

Interface Hotkeys

Key Action
s Toggle the sidebar (questions list)
t View the traceback
←, k View previous question
β†’, j View next question
d Open question in your browser
f Search for answers on Google
q, ctrl+c Quit the interface.
i Report an issue with wtpython

Roadmap

This project is still in the early phases, but we have big plans going forward. We hope to tackle:

  • Windows support (without WSL)
  • Jupyter integration
  • More interactive interface
  • User configuration settings
  • Much much more!

Feedback / Support

If you have any feedback, please create an issue or start a discussion. There is also a Discord server which you can join with this invite.

Contributing

See CONTRIBUTING.md