Skip to main content

Play funny meme sounds when Python errors occur!

Project description

Meme Errors

Play funny meme sounds whenever Python exceptions occur — even if the error is handled! Customize your sounds per exception type, set trim duration, and enjoy some chaotic developer humor.

Features

  • Automatic memes on uncaught exceptions.
  • Handled exceptions support via decorator or context manager.
  • Custom sounds per exception type.
  • Automatic trimming of long sounds (default 3 seconds).
  • Optional custom duration per error or decorator.

Installation

pip install meme-errors

Use code with caution. Usage Global Uncaught Errors Automatically plays a meme when an exception occurs that is not handled:

import meme_errors

# This will play the default Exception meme
1 / 0  # Division by zero

Custom Memes for Specific Exceptions

import meme_errors

# Set a custom meme for TypeError
meme_errors.set_error_sound(TypeError, "/path/to/emotional-damage-meme.mp3")

# Set a custom meme for FileNotFoundError
meme_errors.set_error_sound(FileNotFoundError, "/path/to/galaxy-meme.mp3")

Handled Exceptions Using a Decorator

from meme_errors import meme_sound_on_error

@meme_sound_on_error
def risky_func():
    try:
        open("missing_file.txt")  # FileNotFoundError
    except FileNotFoundError:
        print("Caught the error, but meme still plays!")

risky_func()

Custom Duration for Decorator

# Set duration to 5 seconds
risky_func = meme_sound_on_error(risky_func, duration_ms=5000) 

Manual Meme Playback

from meme_errors import play_meme_sound

# Play TypeError meme for default 3 seconds
play_meme_sound(TypeError)

# Play TypeError meme for 5 seconds
play_meme_sound(TypeError, duration_ms=5000)

Default Memes Included:

Exception Type Default Meme File
TypeError emotional-damage-meme.mp3
FileNotFoundError galaxy-meme.mp3
Exception (fallback) meme-de-creditos-finales.mp3

You can replace these using set_error_sound().

Notes:

  • Audio Trimming: Audio is trimmed to a default of 3 seconds to prevent long playback.
  • Compatibility: Works on Windows, macOS, and Linux (requires playsound and pydub).
  • Non-blocking: Playback is handled via playsound.

License:

MIT License – see LICENSE file.

Contributing:

Fork the repo, add your own meme sounds or improve features, and submit a Pull Request.
Have fun making Python errors hilarious! 😂

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

meme_errors-0.1.5.tar.gz (371.3 kB view details)

Uploaded Source

Built Distribution

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

meme_errors-0.1.5-py3-none-any.whl (369.5 kB view details)

Uploaded Python 3

File details

Details for the file meme_errors-0.1.5.tar.gz.

File metadata

  • Download URL: meme_errors-0.1.5.tar.gz
  • Upload date:
  • Size: 371.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.15

File hashes

Hashes for meme_errors-0.1.5.tar.gz
Algorithm Hash digest
SHA256 8d7e1e87d6fc6bb3044512efa960d6810874fe38308276bee09a017eb0011419
MD5 f7f32e80f96f4ec853ed15b4c40742aa
BLAKE2b-256 517789b97afe9d5f3541b942b94b5351ca14d2bf9581c454a97f9ef4cc493983

See more details on using hashes here.

File details

Details for the file meme_errors-0.1.5-py3-none-any.whl.

File metadata

  • Download URL: meme_errors-0.1.5-py3-none-any.whl
  • Upload date:
  • Size: 369.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.15

File hashes

Hashes for meme_errors-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 8430671b5b6aed561e17c7fb8b01eaf5d6d0035d504d8fdcf8c37cd7b589ba3c
MD5 7496e0449bb70ca22be0ebd098cf5cd0
BLAKE2b-256 4bcf19b999db69a712db9d0188abd4f4c28e0169777d96a8371ab3c7797725df

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