A Python library that provides philosophical wisdom when errors occur
Project description
philosopherror
A silly yet insightful Python library that provides philosophical wisdom when errors and warnings occur.
Overview
philosopherror enriches your debugging experience by adding philosophical quotes from both Eastern and Western philosophers whenever exceptions are raised or warnings are shown. It maps different error types to relevant philosophers, ensuring that the wisdom you receive is somewhat relevant to the error you're encountering.
Features
- Automatically adds philosophical quotes to exceptions and warnings
- Maps specific error types to relevant philosophers
- Provides a decorator for adding philosophical wisdom to function errors
- Includes a direct API for accessing philosophical wisdom
- Can be enabled/disabled at runtime
- Contains genuine quotes from philosophers (no hallucinations)
Installation
pip install philosopherror
Usage
Basic Usage
Simply import the library at the top of your script:
import philosopherror
That's it! Now when errors occur, you'll get philosophical wisdom alongside them.
Error Type Mapping
Different error types are mapped to philosophers whose wisdom might be relevant:
- Syntax errors: Wittgenstein, Confucius, Lao Tzu
- Logic errors: Aristotle, Kant, Plato
- Runtime errors: Seneca, Epictetus, Rumi
- System/IO errors: Marcus Aurelius, Rabindranath Tagore, Confucius
Decorator
You can use the decorator to add philosophical wisdom to specific functions:
@philosopherror.exception_handler
def risky_function():
# This function might raise exceptions
int("not a number")
Direct API
# Get wisdom from a specific philosopher
print(philosopherror.wisdom_from("Nietzsche"))
# Get random wisdom
print(philosopherror.random_wisdom())
# List all available philosophers
philosophers = philosopherror.list_philosophers()
Enable/Disable
You can enable or disable the philosophical error messages at runtime:
# Disable philosophical errors
philosopherror.disable()
# Re-enable philosophical errors
philosopherror.enable()
Philosophers Included
Western Philosophy
- Socrates, Plato, Aristotle
- Marcus Aurelius, Epictetus, Seneca
- Nietzsche, Kant, Wittgenstein
- Sartre, Camus
Eastern Philosophy
- Confucius, Lao Tzu, Buddha
- Zhuangzi, Sun Tzu
- Rumi, Rabindranath Tagore, Alan Watts
Indian Philosophy
- Swami Vivekananda, Sri Ramakrishna, Sri Aurobindo
- J. Krishnamurti, Ramana Maharshi, Adi Shankaracharya
- Paramahansa Yogananda, Kabir, Chanakya
- Thiruvalluvar, Jaggi Vasudev (Sadhguru)
Example Output
Traceback (most recent call last):
File "example.py", line 10, in <module>
int("not a number")
ValueError: invalid literal for int() with base 10: 'not a number'
"The only true wisdom is in knowing you know nothing."
— Socrates
Contributing
Feel free to contribute additional philosophers and quotes by submitting a pull request.
License
MIT License
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file philosopherror-0.1.0.tar.gz.
File metadata
- Download URL: philosopherror-0.1.0.tar.gz
- Upload date:
- Size: 14.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9d2ed81deb080ee8c523ccffeb340752514bd837d519f51277f2006732eede26
|
|
| MD5 |
23111dfd40f7b7ed9ddd8fc404baa461
|
|
| BLAKE2b-256 |
dc30c1a1dcf810a3734f29545432f80cb5aaeba2f6256ca3487c66e6fd9cf6a3
|
File details
Details for the file philosopherror-0.1.0-py3-none-any.whl.
File metadata
- Download URL: philosopherror-0.1.0-py3-none-any.whl
- Upload date:
- Size: 15.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1671b961a2b6e833e6c10bc8fd68498eb211531d8fe456e37099308d1977ec0c
|
|
| MD5 |
890f1de635c89ba928a6296755bba3d0
|
|
| BLAKE2b-256 |
100697dd16bf19df4615e9c63e45d7972e84492778944da9dbb982b86d8a70c1
|