Skip to main content

A CLI tool that explains Python errors in simple human language.

Project description

Error Translator CLI

Overview

A lightweight, rule-based command-line tool designed to translate confusing Python traceback errors into plain, human-readable English and suggest actionable fixes.

Key Features

  • No AI or LLMs Required: Runs entirely locally using fast, regex-based pattern matching.
  • Beginner Friendly: Explains the root cause of errors in simple English terminology, making debugging more approachable.
  • Actionable Guidance: Provides practical, suggested fixes tailored to your specific code context.
  • Pinpoint Accuracy: Extracts and highlights the exact file name and line number where the code encountered an issue.
  • Improved Readability: Utilizes well-formatted, color-coded terminal output to make reading errors easier.

Installation

You can install this tool globally on your machine using pip:

pip install error-translator-cli-v2

Quick Start Guide

You can use the Error Translator in three distinct ways, depending on your preferred workflow:

1. Magic Import (Recommended)

Simply add this single import statement at the top of your Python script. If your script crashes, the tool will automatically intercept and translate the error.

import error_translator.auto

# Your normal code...
math_is_broken = 10 / 0  # This crash will be automatically intercepted and translated

2. Run Scripts via CLI

You can execute your Python files directly through the provided CLI tool. It will run your program normally and intercept any crashes if they occur.

explain-error run script.py

3. Translate Raw Error Strings

You can also pass raw error messages directly as a string or pipe them from another command.

Pass directly:

explain-error "TypeError: unsupported operand type(s) for +: 'int' and 'str'"

Pipe from a file:

cat error.log | explain-error

Supported Errors

Currently, the tool can accurately diagnose and explain the following Python errors:

  • NameError
  • TypeError
  • IndexError
  • KeyError
  • ZeroDivisionError
  • ModuleNotFoundError
  • AttributeError

Note: More error definitions are actively being added to the database.

Cloud API

This tool includes a built-in FastAPI server so you can integrate the translation engine into your own web apps or VS Code extensions.

uvicorn error_translator.server:app --reload

---
Built by Gourabananda Datta.

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

error_translator_cli_v2-1.0.5.tar.gz (5.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

error_translator_cli_v2-1.0.5-py3-none-any.whl (6.4 kB view details)

Uploaded Python 3

File details

Details for the file error_translator_cli_v2-1.0.5.tar.gz.

File metadata

  • Download URL: error_translator_cli_v2-1.0.5.tar.gz
  • Upload date:
  • Size: 5.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.4

File hashes

Hashes for error_translator_cli_v2-1.0.5.tar.gz
Algorithm Hash digest
SHA256 b5174ed4a0b72ca1c19702ed349fee86c78e8f8cf0c985a2e22fe8b09813dabb
MD5 04bfa50ffa8483cc41a88c12be1ecd50
BLAKE2b-256 e625af7674c1feba42c08707189e4856497a469539ba277460f5ad38f45805fa

See more details on using hashes here.

File details

Details for the file error_translator_cli_v2-1.0.5-py3-none-any.whl.

File metadata

File hashes

Hashes for error_translator_cli_v2-1.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 a925c9e1a767fa7826a6a561e6b12aada091f6ad57da0fa8b6f9151650349196
MD5 cbd050d1493a73fe38d1ce9f2185591b
BLAKE2b-256 c6358a78a8c748ce7413bf60587535edd908eef39803f3660347d2dbdabd46d7

See more details on using hashes here.

Supported by

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