About English semantic understanding in exception handling (collection is recommended)
The semantics of common problems (Exception, Error, Warning) in Python
Common exception semantics (Exception)
Exception |
---|
-
Exception base class for general errors
-
BaseException The base class of all exceptions
-
SystemExit interpreter requests to exit
-
KeyboardInterrupt user interrupt execution (usually input ^C)
-
StopIteration iterator has no more values
-
GeneratorExit generator (generator) has an exception to notify the exit
Common error semantics (Error)
Error type |
---|
-
TypeError invalid operation on type
-
SystemError General interpreter system error
-
TabError Tab and spaces mixed
-
StandardError The base class for all built-in standard exceptions
-
ArithmeticError The base class for all numerical calculation errors
-
FloatingPointError floating point calculation error
-
OverflowError Numerical operation exceeds the maximum limit
-
ZeroDivisionError divide (or modulo) zero (all data types)
-
AssertionError Assertion statement failed
-
AttributeError object does not have this attribute
-
EOFError has no built-in input and reaches the EOF mark
-
EnvironmentError base class for operating system errors
-
IOError Input/output operation failed
-
OSError operating system error
-
WindowsError system call failed
-
ImportError Import module/object failed
-
LookupError base class for invalid data query
-
IndexError does not have this index in the sequence
-
There is no such key in the KeyError map
-
MemoryError memory overflow error (not fatal to the Python interpreter)
-
NameError object not declared/initialized (no attributes)
-
UnboundLocalError access to uninitialized local variables
-
ReferenceError Weak reference attempts to access objects that have been garbage collected
-
RuntimeError General runtime error
-
NotImplementedError Method not yet implemented SyntaxError Python syntax error
-
IndentationError Indentation error
-
ValueError passed an invalid parameter
-
UnicodeError Unicode related errors
-
UnicodeDecodeError Unicode decoding error
-
UnicodeEncodeError Unicode encoding error
-
UnicodeTranslateError Unicode conversion error
Common warning semantics (Warning)
Warning type |
---|
-
RuntimeWarning runtime behavior warning
-
SyntaxWarning Suspicious syntax warning
-
UserWarning User code generated warning
-
DeprecationWarning Warning about deprecated features
-
FutureWarning A warning that the semantics of the structure will change in the future
-
OverflowWarning warning about automatic promotion to long integer
-
PendingDeprecationWarning A warning that the feature will be deprecated