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.2.tar.gz (2.6 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.2-py3-none-any.whl (2.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: meme_errors-0.1.2.tar.gz
  • Upload date:
  • Size: 2.6 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.2.tar.gz
Algorithm Hash digest
SHA256 f78d14dd285f7703f2e62ad3e3ca2b77974c9f96ada265cdc1eb0b4fd1d8dd92
MD5 f7a0c27e4e6148969fd98a2f276d7821
BLAKE2b-256 184f69691c25f2967bbf078c9769914bed9c6ed93ced63c6006c9b39d99e2192

See more details on using hashes here.

File details

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

File metadata

  • Download URL: meme_errors-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 2.4 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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 ddd8564770ff0bfcd06aaeb7e6876a6df219f235ec6da3608422b1ac16c435af
MD5 d53ac1e7630c4f186319e4ef2d6ec111
BLAKE2b-256 f0d321b437b64c5e335aedcdf6e0aab441e975c5732dad42f812bb1d78cbfab7

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