Skip to content

JugalKothari/poetic-errors

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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!

About

A Python package to turn errors into poems.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages