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/JugalKothari/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.3.tar.gz (4.3 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.3-py3-none-any.whl (4.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: poetic_errors-0.1.3.tar.gz
  • Upload date:
  • Size: 4.3 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.3.tar.gz
Algorithm Hash digest
SHA256 024892fcb77a805b704e23d9eba48745059b538cba61b173b741cb47bd349032
MD5 7428f1a71bbc4f74b241c95fb1fde3ca
BLAKE2b-256 4af92e2fc1881b6f2e8b5d127b3e5865389ad380a1b4bfd1b5dfcc889bcbf325

See more details on using hashes here.

File details

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

File metadata

  • Download URL: poetic_errors-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 4.7 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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 aac8fcd053edb000827d82d888ae796b4a77e0494b8c693e3f12bc2459e6ef17
MD5 f50a6dff9a63cf416cc9221b30a16ff6
BLAKE2b-256 8758b07500fb3863e4fc9285eceb1972a9eae03439034861ddf14a6bee7e94ea

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