Affirmative error messages for Python
Project description
Introduction
- ErrorAffirmations:
Affirmative error messages for Python
- Author:
Thomas Gessey-Jones
- Version:
0.1.0-rc
- Homepage:
ErrorAffirmations is a Python library that provides affirmative error messages, to help you feel better about your errors.
Installation
ErrorAffirmations can be directly installed via pip:
pip install erroraffirmations
or from the repository:
git clone git@github.com:ThomasGesseyJones/ErrorAffirmations.git
cd ErrorAffirmations
python -m pip install .
A new installation can be verified as working by running the tests suite:
python -m pip install ".[test]"
python -m pytest
Usage
Simply import the erroraffirmations module and all errors will be appended with an affirmation:
import erroraffirmations
raise Exception('Something went wrong')
Traceback (most recent call last):
File "basic_usage.py", line 3, in <module>
raise Exception('Something went wrong')
Exception: Something went wrong
Remember, every error you encounter is an opportunity for growth and learning. You're capable of overcoming this challenge!
You can also access the affirmations list directly, to add your own affirmations:
from erroraffirmations import add_affirmation, get_affirmations, \
clear_affirmations
# Show part of the current list of affirmations
for affirmation in list(get_affirmations())[:5]:
print(affirmation)
print("\n")
# Remove all existing affirmations
clear_affirmations()
# Add your own affirmations
add_affirmation("You are doing great!")
# Show new list of affirmations
print(get_affirmations())
print("\n")
# Let us see it in action
raise ValueError("1 + 1 is not equal to 3")
The best programmers encounter errors regularly. It's a sign that you're exploring new territory and pushing your limits.
Mistakes are an essential part of the learning process. You're getting closer to the solution with each error you encounter.
The fact that you're facing this challenge head-on shows your determination and dedication. You've got this!
Take a moment to step back, breathe, and approach the problem from a different angle. A fresh perspective can lead to breakthroughs.
Remember, every error you encounter is an opportunity for growth and learning. You're capable of overcoming this challenge!
{'You are doing great!'}
Traceback (most recent call last):
File "/home/thomas/Documents/Pet_Projects/ErrorAffirmations/examples/editing_affirmations.py", line 22, in <module>
raise ValueError("1 + 1 is not equal to 3")
ValueError: 1 + 1 is not equal to 3
You are doing great!
Process finished with exit code 1
Code snippets demonstrating the usage of ErrorAffirmations can be found in the examples directory.
License
ErrorAffirmations is licensed under the MIT license. See the LICENSE file for more details.
Contributing
Contributions are always welcome and greatly appreciated.
You can open an issue to report bugs or to propose new features.
Or fork the repository, make your changes, and submit a pull request
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
Hashes for erroraffirmations-0.1.0rc0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6624ad56c7062ccb8f9385aaef4ecdde04da7e4ad20913efcb88f7edddd29401 |
|
MD5 | 0e4133735051ea800d1c26d846073723 |
|
BLAKE2b-256 | 86d344d261181720b4e8fa52d7c9e8262bca9e60e50a6da9cc47c1814c88550b |
Hashes for erroraffirmations-0.1.0rc0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e271e30f0394971846f0d1328281b6ebd32b3efeb248734e50c057f64d5ddc4e |
|
MD5 | dab5a94a2e1dfef13e65e94578ae2147 |
|
BLAKE2b-256 | 0012a572101660961092e4ffb8834eaa2bfa0b9e17124d043dafd1c04047bbe8 |