Skip to main content

Offline Python traceback translator and error explainer CLI that converts exceptions into clear explanations and actionable fixes.

Project description

Error Translator

PyPI Version Python 3.9+ GitHub Stars PyPI Downloads License Build Status

Error Translator CLI V2 demo banner


Error Translator is an offline Python traceback translator and exception explainer that converts raw errors into crystal-clear explanations and immediately actionable fixes. Built for local-first development workflows, it supports direct CLI usage, an automatic import hook, a programmatic Python API, and a FastAPI integration.

If this project saves you debugging time, please consider starring it on GitHub: https://github.com/gourabanandad/error-translator-cli-v2

Why Developers Like It

  • Fast Feedback Loop: Turn stack traces into direct next actions in seconds.
  • Works Offline: No telemetry dependency for core translation behavior.
  • Beginner-Friendly Output: Explanations are clear enough for learners, practical enough for teams.
  • Multiple Entry Points: CLI, import hook, Python API, and FastAPI all share one deterministic engine.

Key Features

  • CLI-First Architecture: Seamlessly process scripts, direct error strings, or piped logs via the explain-error command.
  • Professional Rich Terminal UI: Clean panels, syntax-highlighted code context, structured sections, and improved readability for day-to-day debugging.
  • Automatic Integration Mode: Inject the module via import error_translator.auto to automatically override sys.excepthook for graceful, translated crash reporting.
  • Extensible API Surfaces: Integrate natively within Python or expose the core engine over HTTP via the included FastAPI server.
  • Deterministic Rules Engine: High-performance, regex-based matching powered by rules.json guarantees offline and privacy-first translations.
  • Optional Native Acceleration: A C extension matcher (fast_matcher) can accelerate rule scanning, with automatic fallback to pure Python when unavailable.
  • Optional AST Insight Hooks: Registered handlers can append targeted hints (ast_insight) for selected error types.

Installation

Python requirement: 3.9 or newer.

Install the latest stable release directly from PyPI:

pip install error-translator-cli-v2

Verify the installation:

explain-error --version

Usage Guide

1. Command-Line Interface (CLI)

Run a Python script and catch any unhandled exceptions:

explain-error run script.py

Provide an error string directly:

explain-error "NameError: name 'usr_count' is not defined"

Pipe system or Docker logs into the engine:

cat error.log | explain-error

Emit structured JSON for scripting and automation:

explain-error --json "NameError: name 'x' is not defined"
# {"explanation": "...", "fix": "...", "matched_error": "...", "file": "...", "line": "...", "code": "...", "ast_insight": null}

Show an about screen with project metadata and quick usage examples:

explain-error --about

The --json flag works with every input mode (run <script>, raw string, piped log).

2. Automatic Import Hook

Catch and translate unhandled exceptions globally by importing the module:

import error_translator.auto

def main():
    # This TypeError will automatically trigger the error translator
    total = "Users: " + 42

if __name__ == "__main__":
    main()

3. Jupyter Integration

Load the Error Translator as a Jupyter extension to automatically translate exceptions in your notebooks:

%load_ext error_translator.jupyter

Any unhandled exception in subsequent cells will display:

  • The standard Jupyter traceback (for reference)
  • A formatted translation with explanation and suggested fix
  • AST-based insights (when applicable)

This integrates seamlessly with Jupyter notebooks and JupyterLab, allowing you to debug interactively with clear, actionable error explanations.

4. FastAPI Service

Start the built-in HTTP server for remote translation services:

uvicorn error_translator.api.server:app --host 127.0.0.1 --port 8000 --reload

Submit a traceback payload via the exposed REST API:

curl -X POST http://127.0.0.1:8000/translate \
  -H "Content-Type: application/json" \
  -d "{\"traceback_setting\":\"Traceback (most recent call last):\\n  File 'app.py', line 14, in <module>\\n    total = 'Users: ' + 42\\nTypeError: can only concatenate str (not 'int') to str\"}"

Additional endpoints:

  • GET /health returns service status.
  • GET / serves the bundled web UI from error_translator/api/static/index.html.

5. Optional C Extension Build

The translation engine automatically attempts to import error_translator.fast_matcher. If it is not built or not available on the platform, Error Translator falls back to the pure Python regex loop with no behavior change.

Build the extension in-place from the repository root:

python setup_ext.py build_ext --inplace

This step is optional and intended for local performance optimization.

Documentation

Detailed documentation is located in the docs/ directory:

  • Real-World Examples: Practical demonstrations comparing raw tracebacks with their translated counterparts.
  • Architecture & Internals: Comprehensive teardown of the regex engine, AST integration, and internal design philosophy.
  • Contributing Guidelines: Standards, PR checklists, and instructions for utilizing our AI-Powered Rule Builder.

Maintainers

This project is actively developed and maintained by Gourabananda Datta alongside our open-source contributors.

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

Uploaded Source

Built Distributions

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

error_translator_cli_v2-3.0.6-cp313-cp313-win_amd64.whl (51.5 kB view details)

Uploaded CPython 3.13Windows x86-64

error_translator_cli_v2-3.0.6-cp313-cp313-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (55.7 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64manylinux: glibc 2.5+ x86-64

error_translator_cli_v2-3.0.6-cp313-cp313-macosx_11_0_arm64.whl (49.0 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

error_translator_cli_v2-3.0.6-cp313-cp313-macosx_10_13_x86_64.whl (48.6 kB view details)

Uploaded CPython 3.13macOS 10.13+ x86-64

error_translator_cli_v2-3.0.6-cp312-cp312-win_amd64.whl (51.5 kB view details)

Uploaded CPython 3.12Windows x86-64

error_translator_cli_v2-3.0.6-cp312-cp312-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (55.8 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64manylinux: glibc 2.5+ x86-64

error_translator_cli_v2-3.0.6-cp312-cp312-macosx_11_0_arm64.whl (49.0 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

error_translator_cli_v2-3.0.6-cp312-cp312-macosx_10_13_x86_64.whl (48.6 kB view details)

Uploaded CPython 3.12macOS 10.13+ x86-64

error_translator_cli_v2-3.0.6-cp311-cp311-win_amd64.whl (51.5 kB view details)

Uploaded CPython 3.11Windows x86-64

error_translator_cli_v2-3.0.6-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (55.6 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64manylinux: glibc 2.5+ x86-64

error_translator_cli_v2-3.0.6-cp311-cp311-macosx_11_0_arm64.whl (49.0 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

error_translator_cli_v2-3.0.6-cp311-cp311-macosx_10_9_x86_64.whl (48.6 kB view details)

Uploaded CPython 3.11macOS 10.9+ x86-64

error_translator_cli_v2-3.0.6-cp310-cp310-win_amd64.whl (51.5 kB view details)

Uploaded CPython 3.10Windows x86-64

error_translator_cli_v2-3.0.6-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (55.5 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64manylinux: glibc 2.5+ x86-64

error_translator_cli_v2-3.0.6-cp310-cp310-macosx_11_0_arm64.whl (49.0 kB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

error_translator_cli_v2-3.0.6-cp310-cp310-macosx_10_9_x86_64.whl (48.6 kB view details)

Uploaded CPython 3.10macOS 10.9+ x86-64

error_translator_cli_v2-3.0.6-cp39-cp39-win_amd64.whl (51.5 kB view details)

Uploaded CPython 3.9Windows x86-64

error_translator_cli_v2-3.0.6-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (55.3 kB view details)

Uploaded CPython 3.9manylinux: glibc 2.17+ x86-64manylinux: glibc 2.5+ x86-64

error_translator_cli_v2-3.0.6-cp39-cp39-macosx_11_0_arm64.whl (49.0 kB view details)

Uploaded CPython 3.9macOS 11.0+ ARM64

error_translator_cli_v2-3.0.6-cp39-cp39-macosx_10_9_x86_64.whl (48.5 kB view details)

Uploaded CPython 3.9macOS 10.9+ x86-64

File details

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

File metadata

  • Download URL: error_translator_cli_v2-3.0.6.tar.gz
  • Upload date:
  • Size: 47.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for error_translator_cli_v2-3.0.6.tar.gz
Algorithm Hash digest
SHA256 875460600d2c7406bccb9c155a6ae339182d7b9ec98f36b627d297c3d3e4cd51
MD5 8e6283b4cb0096e7ab3d56ea17ecc484
BLAKE2b-256 965e9316229580db509cd2caa2a632a9aeaca22d7b0055d1af65b9b1b25b8fd2

See more details on using hashes here.

File details

Details for the file error_translator_cli_v2-3.0.6-cp313-cp313-win_amd64.whl.

File metadata

File hashes

Hashes for error_translator_cli_v2-3.0.6-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 4b6f5ecc77a7e80f58c20e426803bd7deeb16eeda776625157ea61dcb221ffc7
MD5 bb59b5b82ea67f6567b854cc983f1deb
BLAKE2b-256 85e0066d20a2baaae14c7c24852e0de4620445bc555c0c165cafb555a2455af3

See more details on using hashes here.

File details

Details for the file error_translator_cli_v2-3.0.6-cp313-cp313-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for error_translator_cli_v2-3.0.6-cp313-cp313-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 7011c4d4f6722129cbb251d913e1bfab0681f5b2e1ce57b699b24f1800d945f1
MD5 c71053be34992b65ce2a57c98ca8f11d
BLAKE2b-256 2d597ca2c282f3695f8801ec251f78693fe4f5fe940f4756857428e5400ba904

See more details on using hashes here.

File details

Details for the file error_translator_cli_v2-3.0.6-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for error_translator_cli_v2-3.0.6-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 e4b94d93740bcf4272e5fca94b1b62330b5b84c25889b1f97929cdfa4102ccf7
MD5 23d11de4dac8791dccea1b24ffb84765
BLAKE2b-256 acf07ea95ea0b7b602efcda76b90f0fc12bc047e5796886b66905ea78f314f79

See more details on using hashes here.

File details

Details for the file error_translator_cli_v2-3.0.6-cp313-cp313-macosx_10_13_x86_64.whl.

File metadata

File hashes

Hashes for error_translator_cli_v2-3.0.6-cp313-cp313-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 b7e715d3f664ee29bb1ac4e291b9e8ce9a1c73d00303e51cb3beef437a8c2f0b
MD5 f281f78a5b18584dc9c9645ef44d4809
BLAKE2b-256 bba793188564f40ee1fcc40d2caf201f8add9077750b6bd04ec96b4d58f88c38

See more details on using hashes here.

File details

Details for the file error_translator_cli_v2-3.0.6-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for error_translator_cli_v2-3.0.6-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 71e958af9390415a0ecf5c6c5d43f12ac01d290840f66e1132370ec81965c39e
MD5 72f9060b78a09cf2f286252e008cf101
BLAKE2b-256 33c615cd3593123ea757eb82aa468e2775c23716d67206ad20dd7e14ec75f31d

See more details on using hashes here.

File details

Details for the file error_translator_cli_v2-3.0.6-cp312-cp312-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for error_translator_cli_v2-3.0.6-cp312-cp312-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 c10586ff5dad2129c37eccfcc05545f893cdb2041b394bce45f8770df79b37ee
MD5 d4f655188c51192477cd826b7e9abff3
BLAKE2b-256 6e396c1c9d122d21044d95e7c1d6c2323df4668cd572005049a066a1d224c248

See more details on using hashes here.

File details

Details for the file error_translator_cli_v2-3.0.6-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for error_translator_cli_v2-3.0.6-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 b2d9eccd3b57787b6508c93c3d71723004e832275d9377a48feb70b4bafd030e
MD5 466657ca6c6aca9561edfe5b66103f96
BLAKE2b-256 23ad65c0275a5065ff04228fce5d3319176a39861eee0a548c45ff8c104f90f2

See more details on using hashes here.

File details

Details for the file error_translator_cli_v2-3.0.6-cp312-cp312-macosx_10_13_x86_64.whl.

File metadata

File hashes

Hashes for error_translator_cli_v2-3.0.6-cp312-cp312-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 18e24d87c48488372c5e3cdcf0e18cd738092b43b763f7b91367062b914c4972
MD5 c7f1ede4fcb53c4ed2d68049878c1d6c
BLAKE2b-256 3ef669d2c851f73a1151c0536f30d1ab91c1ba52b2ec912298a570e91179b565

See more details on using hashes here.

File details

Details for the file error_translator_cli_v2-3.0.6-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for error_translator_cli_v2-3.0.6-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 9483ca2534c72ec42bc9805a4851beb1234bef0ba7140f9a97ca1b71cb60ded9
MD5 9daa6f0496c6d5586f19a0cb25f33d9f
BLAKE2b-256 20a7380f585af7c80092a0462ccd3cca98da699886e27fd13c1d4e2b7bf7e53e

See more details on using hashes here.

File details

Details for the file error_translator_cli_v2-3.0.6-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for error_translator_cli_v2-3.0.6-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 b2083b0060da1344c3449c1ba074c340977be2d285ecc022b99de9bb7fcf02da
MD5 6339bbb91ea6526e1ffd0204c8af9cc6
BLAKE2b-256 295b55d7f0e558e81707596b7cfdaeeba854e4689016d3b2e61ee42753035d60

See more details on using hashes here.

File details

Details for the file error_translator_cli_v2-3.0.6-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for error_translator_cli_v2-3.0.6-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 69dcf96378cc4cd813ea1089f520ed44e35ebbb499987c03d7ef4a7e6a895b5b
MD5 88343cf84695e33dd39ef5628cde6dbe
BLAKE2b-256 60d50eb4ae51f0f719ce987914f210dbfd8ae322b159e6029decfe4bc80cb6ea

See more details on using hashes here.

File details

Details for the file error_translator_cli_v2-3.0.6-cp311-cp311-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for error_translator_cli_v2-3.0.6-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 7781d73138670999a4b1f36b39df78ded5c16d55d9df410bb6f7914435e53031
MD5 2314ef277498cd28bd65dcb1b79d0671
BLAKE2b-256 1959ac8a2b951aaf3fdea700260c1611eb721a912d64f36d797c233f3e84bed8

See more details on using hashes here.

File details

Details for the file error_translator_cli_v2-3.0.6-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for error_translator_cli_v2-3.0.6-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 39a8215d3691555502b1a5b26ceabe1e1b021a252d3323c5e122969503bb356d
MD5 d94fbbe6a0ec90882768fb6bbfe9047e
BLAKE2b-256 b6f276e4158efd5c96d58f0769e6fe2b5c0a54bcc53c04b8dec392496076e5a9

See more details on using hashes here.

File details

Details for the file error_translator_cli_v2-3.0.6-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for error_translator_cli_v2-3.0.6-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 aedf4ef9e4a0456b4f7a97f6b14b836d29e512717aa9aa7f208f84746d46087e
MD5 2a325b8f2dbe3c9aae7d2ab5352c5612
BLAKE2b-256 cb1397775844bc5f28756d559105a567ff5470c46e59a367c5342c4ac1427bcc

See more details on using hashes here.

File details

Details for the file error_translator_cli_v2-3.0.6-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for error_translator_cli_v2-3.0.6-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 2a65f97e9be7c46fa6ba2e54baa478813e885509c16491c2b7b042fc3aecdd9c
MD5 ccd9ca8ae0088228bd14f6af2de24fb6
BLAKE2b-256 25c00adfd10e2028ce52113fc55edcc0d90e18948d784e8f3ac9809542c243f5

See more details on using hashes here.

File details

Details for the file error_translator_cli_v2-3.0.6-cp310-cp310-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for error_translator_cli_v2-3.0.6-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 081b0565d4030bb3ce1696975c9fe763fccc9ceecead336f71f63feda86f78c3
MD5 e539d8d8e1a4def591270058cea61b0a
BLAKE2b-256 381c3ee366d29b12f58cf07f5329ade9883620ad30468f7e8ffa9e44dbb88ab5

See more details on using hashes here.

File details

Details for the file error_translator_cli_v2-3.0.6-cp39-cp39-win_amd64.whl.

File metadata

File hashes

Hashes for error_translator_cli_v2-3.0.6-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 6c5d4fe898886861ff0ed884a1db3b17627fc84b787f249a2b0dbd8844b4961d
MD5 209bb754294d57a4e3e5826c04020e49
BLAKE2b-256 ad22ea828a2381b878ab8ebb4c6dd99cb738d7f492aa316bd90cd0342f9d9de5

See more details on using hashes here.

File details

Details for the file error_translator_cli_v2-3.0.6-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for error_translator_cli_v2-3.0.6-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 7c07e81f7ceadc6def109fdc017f0f6122901d3669a43692aac53042deecd843
MD5 ea7a4e77472033b72cd527ff029fd267
BLAKE2b-256 d4ba25a4b91f4cd9ccaadb7588bcb4e201ea0a1c7eab863e39ec3d0921685a6a

See more details on using hashes here.

File details

Details for the file error_translator_cli_v2-3.0.6-cp39-cp39-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for error_translator_cli_v2-3.0.6-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 567dd5bf33bffdf03dc3163a965081eb65a4e17e495f1cdf65af76c87411373b
MD5 ad1553cd59c7b5361537b0a35050d530
BLAKE2b-256 e25c3b0e75e8a31978ff6c00e7f1582c149c310464befd2c3c640d584cf0ddd8

See more details on using hashes here.

File details

Details for the file error_translator_cli_v2-3.0.6-cp39-cp39-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for error_translator_cli_v2-3.0.6-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 c4cdabc3018a1eb268b1b356674f75a5a201d195ce4a444249549f0f0d1737da
MD5 6f19dd2a42badd08e82521810e0c9335
BLAKE2b-256 489735cbef46dfec573437f757dd7994bd62c285c40d21973efa7673d7eb8a88

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