Debian Codegraph @

README.md

raw symbols SCIP
1 ![friendly-traceback logo](images/friendly_logo.png)
2 # friendly/friendly-traceback
3
4 - **friendly_traceback**: Helps understand Python traceback
5 - **friendly**: Prettier version of the above with some additional enhancements.
6
7 This code repository is for **friendly_traceback**.
8
9 Unless specified otherwise, from here on, **Friendly** will refer to both
10 **friendly** and **friendly_traceback**
11
12 ## Description
13
14 Created with Python beginners in mind, but also useful for experienced users,
15 **Friendly** replaces standard tracebacks
16 by something easier to understand, translatable into various languages.
17 Currently, the information provided by **Friendly** is only available
18 in two languages: English and French.
19
20 The additional information provided by **Friendly** includes
21 `why()` a certain exception occurred,
22 `what()` it means, exactly `where()` it occurred including
23 the value of relevant variables, and
24 [more](https://aroberge.github.io/friendly-traceback-docs/docs/html/).
25
26
27 ![Example](images/explain.png)
28 The screenshot above was taken on Windows. In some other operating systems
29 you might need to type `python3` instead of `python`: **Friendly**
30 requires Python version 3.6 or newer.
31
32 ## Installation
33
34 ```
35 python -m pip install friendly_traceback
36 ```
37
38 Note that most users should install **friendly** instead of **friendly_traceback**,
39
40 ```
41 python -m pip install friendly
42 ```
43
44 This needs to be done from a terminal.
45 In the command shown above,
46 `python` refers to whatever you need to type to invoke your
47 favourite Python interpreter.
48 It could be `python`, `python3`, `py -3.8`, etc.
49
50
51 For some special cases, including
52 using a specialized editor like [Mu](https://codewith.mu) that has its own way
53 of installing Python packages, please consult the documentation.
54
55 ## Documentation
56
57 [The documentation is available by clicking here.](https://friendly-traceback.github.io/docs/index.html)
58
59 ## Example
60
61 The following example illustrates the information that can
62 be provided by **Friendly**.
63
64 ```
65 Traceback (most recent call last):
66 File "<friendly-console:5>", line 1, in <module>
67 test()
68 File "<friendly-console:4>", line 2, in test
69 a = cost(pi)
70 NameError: name 'cost' is not defined
71
72 Did you mean `cos`?
73
74 A `NameError` exception indicates that a variable or
75 function name is not known to Python.
76 Most often, this is because there is a spelling mistake.
77 However, sometimes it is because the name is used
78 before being defined or given a value.
79
80 In your program, `cost` is an unknown name.
81 Instead of writing `cost`, perhaps you meant one of the following:
82 * Global scope: `cos`, `cosh`, `acos`
83
84 Execution stopped on line 1 of file `'<friendly-console:5>'`.
85
86 -->1: test()
87
88 test: <function test>
89
90 Exception raised on line 2 of file `'<friendly-console:4>'`.
91
92 1: def test():
93 -->2: a = cost(pi)
94 ^^^^
95
96 global pi: 3.141592653589793
97 ```
98
99 ## Projects using Friendly
100
101 friendly/friendly-traceback is used by:
102
103 * [HackInScience](https://hackinscience.org)
104 * [futurecoder](https://futurecoder.io)
105 * [CodeGrade](https://www.codegrade.com/blog/friendly-better-error-messages-for-python)
106 * [ddebug](https://github.com/matan-h/ddebug)
107
108 Feel free to contact me to add your project to this list.
109
110 ## Contribute
111
112 Contribute by making suggestions for improvements, pointing out mistakes either in
113 the documentation or in the information provided by **Friendly**, or finding bugs.
114
115 If you speak a language other than English or French and feel ambitious, you might
116 want to work on translations into your own language.
117
118 For more details, see [CONTRIBUTING](CONTRIBUTING.md)
119
120 ## License: MIT
121
122 For more details, see [LICENSE](LICENSE).
123
124 Some ideas were adopted from
125 [DidYouMean-Python (aka BetterErrorMessages)](https://github.com/SylvainDe/DidYouMean-Python)
126 by Sylvain Desodt, a project that is also using the MIT license; as of October 2021,
127 that particular project is no longer maintained.
128
129 ## Code of Conduct
130
131 In short: be respectful of everyone.
132
133 For more details, see [Code of Conduct](CODE_OF_CONDUCT.md)
134
135 ## JetBrains support
136
137 We graciously acknowledge the support of [JetBrains](
138 https://www.jetbrains.com/community/opensource/?from=friendly-traceback)
139 which enables us to use the professional version
140 of PyCharm for developing **Friendly**.
141
142 [![JetBrains](images/jb_beam.png)](
143 https://www.jetbrains.com/community/opensource/?from=friendly-traceback)