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.4.tar.gz (371.5 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.4-py3-none-any.whl (369.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: meme_errors-0.1.4.tar.gz
  • Upload date:
  • Size: 371.5 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.4.tar.gz
Algorithm Hash digest
SHA256 0895172448cb811c35e1a151b257ae6db15585d99c70ab662b389ca562a66098
MD5 2ebac8cc1e9236663bc51c1f1b8285a3
BLAKE2b-256 dcfccbde3cac6c082a0b2147dd28a8d60cba8b3f21062c988774758bb789b91e

See more details on using hashes here.

File details

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

File metadata

  • Download URL: meme_errors-0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 369.6 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.4-py3-none-any.whl
Algorithm Hash digest
SHA256 fd13785c6e594477a7a46ac33d6914bcafcd4defcd8e31f9a85bd3d23e7f5021
MD5 36a0ca79d546805d8bab32bc3e4cbbfa
BLAKE2b-256 d9dfbf850b48ecef2d8ef402d463b71b48ac7cf5b3bdcc210793608491432434

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