Yes, I am. I regret it. Every day I stock python errors here (emphasis on clarity over accuracy). With the help of everyone, I would like to create an error dictionary that even monkeys can understand. The categories are divided according to the error content. I want to be able to fly if I copy and paste the error using in-page search. Those who control errors control programming.
SyntaxError: invalid syntax
The syntax is wrong ...
(There are many simple mistakes such as no'or misunderstanding the syntax in the first place)
SyntaxError: duplicate argument 'x' in function definition
The function argument'x' is duplicated! Check it out
SyntaxError: keyword argument repeated
The argument keywords are duplicated (when calling a function, etc.)!
SyntaxError: EOL while scanning string literal
It's not closed with'ya'! Enter'ya' properly!
Example) print ('x)
SyntaxError: Missing parentheses in call to 'x'
Parentheses are required to call'x'. Please put parentheses.
Often, print and exec, which were statements in the python2.X series, are functions in the python3.x series, so you may get angry at that mistake.
NameError: name 'X' is not defined
Nothing is defined by that name! It may be misspelled.
IndentationError: unexpected indent
There is an indent (indentation at the beginning of the line) where it is not needed.
IndentationError: unindent does not match any outer indentation level
The indents (indenting with spaces at the beginning of the line) don't match!
Compare it with the indentation above.
IndentationError: expected an indented block
There is no indentation (indentation with a space at the beginning of the line). .. ..
Indent properly! !! !! !! !! !! !! !! !! !!
TypeError: 'x' object is not callable
The'x' object cannot be called! !!
An error that tends to get angry if you use a name such as list or str for a variable and then try to list it like list (X).
TypeError: f() takes exactly 'x' arguments ('y' given)
The f function is called by specifying y even though x arguments are set! (The number of arguments does not match)
TypeError: ord() expected string of length 1, but int found
The ord function is used for letters, but numbers are used as arguments! (Inferred from English)
TypeError: unhashable type
An error that appears when a variable object (list, etc.) is entered in the Key of a dictionary object.
ImportError: No module named
It's such a module! What's going on!
AttributeError: 'X' object has no attribute 'Y'
The'X'object (where X is a type name such as str or module) doesn't have the'Y'attribute!
Make sure that X really has the attribute Y and that you haven't misspelled it.
UnboundLocalError: local variable 'X' referenced before assignment
It was used before the local variable'X' was defined!
Note that if a value is assigned within a function, the variable is considered a local variable no matter where the assignment expression is written.
Recommended Posts