Skip to main content

Transform Python errors into delightful poems

Project description

Poetic Error Handler 🌹

Transform your Python error messages into delightful poems! This lightweight error handler converts standard Python errors into poetic form while preserving the original error information.

Installation

You can install the package using pip:

pip install poetic-errors

Quick Start

Simply import the module at the start of your Python script:

import poetic_errors

That's it! Your error messages will now be displayed as poems.

Features

  • Converts common Python errors into randomly selected poems
  • Maintains original error messages for debugging
  • Works across all operating systems (Windows, macOS, Linux)
  • Handles different error types with specific poem templates:
    • NameError
    • SyntaxError
    • TypeError
    • And a default template for other errors

Example

If you run code with an undefined variable:

x = y + 1  # y is not defined

You'll see output like:

.-----------------.
| Poetic Error    |
'-----------------'
Roses are red,
Variables are rare,
On line 1, I looked everywhere,
But y just wasn't there.

Original error: name 'y' is not defined

Development

To contribute or modify the package:

  1. Clone the repository:
git clone https://github.com/yourusername/poetic-errors.git
  1. Install in development mode:
pip install -e .

Customization

You can add your own poem templates by modifying the templates dictionary in the PoeticErrorHandler class. Each error type can have multiple poem templates that will be randomly selected.

Requirements

  • Python 3.6 or higher
  • No additional dependencies required

Contributing

Feel free to contribute by:

  • Adding new poem templates
  • Supporting additional error types
  • Improving error detection and formatting
  • Suggesting new features

License

MIT License - Feel free to use and modify!

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

poetic_errors-0.1.2.tar.gz (3.5 kB view details)

Uploaded Source

Built Distribution

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

poetic_errors-0.1.2-py3-none-any.whl (3.8 kB view details)

Uploaded Python 3

File details

Details for the file poetic_errors-0.1.2.tar.gz.

File metadata

  • Download URL: poetic_errors-0.1.2.tar.gz
  • Upload date:
  • Size: 3.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.11.9

File hashes

Hashes for poetic_errors-0.1.2.tar.gz
Algorithm Hash digest
SHA256 df1149d8593bfc814eb0c9f330e80f26dc21da99c2a024f8e879a83ff925e919
MD5 819b298bab205a4c8d2bb29e57264c0d
BLAKE2b-256 22fc4cc32779b858ac5d58fe6c138e149b11436678c1653eaf7b1fd608b2785f

See more details on using hashes here.

File details

Details for the file poetic_errors-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: poetic_errors-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 3.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.11.9

File hashes

Hashes for poetic_errors-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 cfc4f1fc7e41cdbf1198b4d7276f179f39b218841124fd598898bd615d8e2ada
MD5 9f5949a1db98660fc458a016d7d4ff3b
BLAKE2b-256 4daee9688b928e7c3d5002775f914f2328ee51fccfda704c57d14974e9e9bf82

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