Comments (3)
Here's a first example:
import friendly
import logging
logging.basicConfig(filename="ignore.log")
friendly.set_lang('fr')
a = 1
b = 0
try:
c = a / b
except Exception:
friendly.explain_traceback(redirect="capture")
result = friendly.get_output()
logging.error(result)
And here's the output file
ERROR:root:
Traceback (most recent call last):
File "ignore.py", line 10, in <module>
c = a / b
ZeroDivisionError: division by zero
Une exception de type `ZeroDivisionError` se produit lorsque vous essayez de diviser une valeur
par zéro soit directement ou en utilisant une autre opération mathématique.
Vous divisez par le terme suivant
b
qui est égal à zéro.
Exception levée à la ligne 10 du fichier ignore.py.
8: b = 0
9: try:
-->10: c = a / b
^^^^^
11: except Exception:
a: 1
b: 0
from friendly.
génial, c'est tout à fait ça!
Mercii!!
from friendly.
@AlvesInfo J'ai rajouté une section dans la documentation (en anglais) avec une explication supplémentaire qui pourrait être utile.
Le lien est le suivant: https://aroberge.github.io/friendly-traceback-docs/docs/html/usage.html#logging
from friendly.
Related Issues (20)
- Using new information for SyntaxError for Python 3.10 HOT 2
- NameError on missing stdlib imports HOT 2
- Internet connection lost, or server unreachable HOT 6
- Use SITE_PACKAGES to short paths
- MemoryError HOT 5
- tox won't pass HOT 14
- TypeError: dict.update() argument after ** must be a mapping, not tuple HOT 2
- formatting placeholder issue in attribute_error.py HOT 2
- AssertionError HOT 3
- TypeError measuring uncalled function HOT 1
- SyntaxError with no explanation HOT 3
- ValueError: month must be in 1..12 HOT 4
- Improved location information
- Introduce Friendly.help() HOT 1
- Remove more()
- ValueError: invalid literal for int() with base 10: '' HOT 7
- Future work: more complete search of "bad lines" HOT 1
- Make rich optional HOT 7
- TypeError cases from bugs.python.org HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from friendly.