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.1.tar.gz (6.3 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.1-py3-none-any.whl (6.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: tracor-0.1.1.tar.gz
  • Upload date:
  • Size: 6.3 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.1.tar.gz
Algorithm Hash digest
SHA256 f83fe739cea8fe2f2ccb7cc74600ca28516f922c99eef801fa4766f0e04c12b7
MD5 e839a04cec29fa497c5f4a4a7649e33b
BLAKE2b-256 ef48a7aadd4a7cb877fd0bf1eb68d7f777af3bd6458a149d784fb14f9fdafd00

See more details on using hashes here.

File details

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

File metadata

  • Download URL: tracor-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 6.6 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 343177a75b5be670cf8c80542211e326eeadd6d868c2677ebd6c010af3fb4a01
MD5 e0662c2ca44d09b49d3d3affb37254f1
BLAKE2b-256 425510a521a901824d1a6d14c37532ad08e3dd3e6fd61c08fddbfab411420fb3

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