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

Uploaded Python 3

File details

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

File metadata

  • Download URL: meme_errors-0.1.1.tar.gz
  • Upload date:
  • Size: 2.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.1.tar.gz
Algorithm Hash digest
SHA256 d53b14c331b9c37ed63ca29ebbd38ba78c3472dad776db4e1068b3bb71585b2b
MD5 bad8865467691d8ac7f4edad1d17c12c
BLAKE2b-256 a38c87f76f6a56f8220549098455fe65396036ed30fc8e0305e844e40dd365a1

See more details on using hashes here.

File details

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

File metadata

  • Download URL: meme_errors-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 2.3 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 6bdfa99289a1242349cf6ef6f91944c439766863d51fab8ca5f0bc02ad146fbc
MD5 36a840e761d90b05be902ddae65eea5c
BLAKE2b-256 73265531a1722c847384f1133d48daa8dabe0b716ff9bf579ad95eea4f60ed5f

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