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.6.tar.gz (7.0 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.6-py3-none-any.whl (7.4 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for error_translator_cli_v2-1.0.6.tar.gz
Algorithm Hash digest
SHA256 037267ff38aea8ebc62a219b43bf48f5f4b535383b9de391e694c69db1a237ea
MD5 4e6ef1fd8c465f5938cfd7eae3309cd7
BLAKE2b-256 a3e314dbf2b499494419cb4c04799c0514cdb98137b7ed16a098a5a830e0dc82

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for error_translator_cli_v2-1.0.6-py3-none-any.whl
Algorithm Hash digest
SHA256 9832051e6ad53cd5a4da57cb5d31fa19e3f7ba357b7546957fce3f6eb93f4708
MD5 0193008b5031c3ffbaae513b8cd640bb
BLAKE2b-256 38bbf4ed760a38ba1b630c232ebdd144260c52fed186627cf9babe0aa05e88eb

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