Skip to main content

A tool for running Python scripts line by line with error handling and reporting.

Project description

Tracor

🚀 Debug Python Scripts Faster

This utility script allows you to execute a Python script line by line, catch any errors that occur along the way, and provide essential debugging information with enhanced context. Additionally, it generates a well-formatted Markdown report highlighting the errors encountered during execution.

Features

  • Executes a Python script line by line.
  • Catches and logs errors with detailed context and colored output for better readability.
  • Generates a Markdown report summarizing the errors.
  • Allows customizable colors for different parts of the error messages.
  • Supports stopping execution on the first error or after a specified number of errors.
  • Includes options to show full tracebacks in the Markdown report.

Usage

Basic Usage

You can download tracor from PyPI:

pip install tracor

Then, you can run it with:

tracor path/to/your_script.py [options]

Usage With Flags

  • --stop-on-error: Stop execution on the first error.
  • --output-file <file>: Specify the output Markdown file for the error report.
  • --log-level <level>: Set the logging level (DEBUG, INFO, WARNING, ERROR, CRITICAL).
  • --max-errors <n>: Limit the number of errors to report before stopping execution.
  • --show-traceback: Include full traceback in the Markdown report.
  • --execution-color <color>: Color for executed lines (default: GREEN).
  • --error-color <color>: Color for error lines (default: RED).
  • --code-color <color>: Color for code in error messages (default: YELLOW).
  • --type-color <color>: Color for error type in error messages (default: CYAN).
  • --message-color <color>: Color for error message in error messages (default: MAGENTA).
  • --traceback-color <color>: Color for traceback in error messages (default: WHITE).

Example -

tracor example_script.py --output-file custom_error_report.md --log-level DEBUG --max-errors 5 --show-traceback --execution-color GREEN --error-color RED --code-color YELLOW --type-color CYAN --message-color MAGENTA --traceback-color WHITE

Output

Terminal Output

The terminal output will show the execution of each line and any errors encountered with enhanced multi-colored highlighting for better readability.

Markdown Report

A well-formatted Markdown report summarizing the errors will be generated. The report includes:

A summary section with the total number of errors. A detailed table with line numbers, code snippets, error types, error messages, and tracebacks.

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

tracor-0.1.3.tar.gz (8.5 kB view details)

Uploaded Source

Built Distribution

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

tracor-0.1.3-py3-none-any.whl (9.2 kB view details)

Uploaded Python 3

File details

Details for the file tracor-0.1.3.tar.gz.

File metadata

  • Download URL: tracor-0.1.3.tar.gz
  • Upload date:
  • Size: 8.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.9.19

File hashes

Hashes for tracor-0.1.3.tar.gz
Algorithm Hash digest
SHA256 b39c2335f6304217cec73b037918cf1843bba5ee1d62b88a1f42f31e9fda3ba3
MD5 5ebc20174fad70606ff76f93905d691e
BLAKE2b-256 cd3339ff1298ca04e127730b454dbc951a00d3bc5cf454efaef2f0bed5af367b

See more details on using hashes here.

File details

Details for the file tracor-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: tracor-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 9.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.9.19

File hashes

Hashes for tracor-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 cf397e436b2de0af688ecf036dfc087041a3cfa0148777b4cd0406bc378af3a3
MD5 4e56a649a18dcdf1824aeb26ab33817e
BLAKE2b-256 f56067559500b7dc329d58a5db3f1f6a0f0be3b827a79cbcba4115b2a168de65

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