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.6.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.6-py3-none-any.whl (369.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: meme_errors-0.1.6.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.6.tar.gz
Algorithm Hash digest
SHA256 a6af46d8fd83bffae9f60d7f5a24cf76e51dc1795893fc127d303ec4b7a81120
MD5 6a4ad6f47f79db095a95ba795431d59e
BLAKE2b-256 8f68db217a98cbfe408b3c9adfea92e7af53a6abd05073faee62179771ab8d46

See more details on using hashes here.

File details

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

File metadata

  • Download URL: meme_errors-0.1.6-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.6-py3-none-any.whl
Algorithm Hash digest
SHA256 9d1db283a20edb300f623875b21e90e5edf3a3d229751baec5695d76873369e8
MD5 38feaa4dae7e50afd202215b0f58a6f1
BLAKE2b-256 81cec76b359df775b0a3ca8f378fa51c5b7d467861ad0222547cdc98147b044e

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