Python exception error summary

 

AssertionError Assertion (assert) failure
AttributeError Attempts to access an unknown object properties
EOFError User input end of file mark EOF (Ctrl + d)
FloatingPointError Floating-point calculation error
GeneratorExit generator.close () method is called when
ImportError When importing module failure
IndexError Sequence index out of range
KeyError Dictionary lookup key does not exist
KeyboardInterrupt User input interrupt key (Ctrl + c)
MemoryError Memory overflow (can release memory by deleting objects)
NameError Try to access a variable that does not exist
NotImplementedError The method has not been implemented
OSError Abnormalities (e.g., open a file does not exist) is generated by the operating system
OverflowError Exceeds the maximum limit value calculation
ReferenceError Weak reference (weak reference) has been recovered trying to access a garbage collection objects
RuntimeError General runtime error
StopIteration Iterator no more value
SyntaxError Python syntax errors
IndentationError Indentation errors
TabError Tab and space mix
SystemError Python compiler system error
SystemExit Python compiler process is closed
TypeError Invalid operation between different types of
UnboundLocalError Access to the local variables (NameError subclass) an uninitialized
UnicodeError Unicode related errors (ValueError subclass)
UnicodeEncodeError Unicode error (a UnicodeError subclass) for coding
UnicodeDecodeError Unicode error (a UnicodeError subclass) when decoding
UnicodeTranslateError Unicode error (a UnicodeError subclass) when conversion is
ValueError Invalid parameter passed
ZeroDivisionError Division by zero



以下是 Python 内置异常类的层次结构:

BaseException
+-- SystemExit
+-- KeyboardInterrupt
+-- GeneratorExit
+-- Exception
      +-- StopIteration
      +-- ArithmeticError
      |    +-- FloatingPointError
      |    +-- OverflowError
      |    +-- ZeroDivisionError
      +-- AssertionError
      +-- AttributeError
      +-- BufferError
      +-- EOFError
      +-- ImportError
      +-- LookupError
      |    +-- IndexError
      |    +-- KeyError
      +-- MemoryError
      +-- NameError
      |    +-- UnboundLocalError
      +-- OSError
      |    +-- BlockingIOError
      |    +-- ChildProcessError
      |    +-- ConnectionError
      |    |    +-- BrokenPipeError
      |    |    +-- ConnectionAbortedError
      |    |    +-- ConnectionRefusedError
      |    |    +-- ConnectionResetError
      |    +-- FileExistsError
      |    +-- FileNotFoundError
      |    +-- InterruptedError
      |    +-- IsADirectoryError
      |    +-- NotADirectoryError
      |    +-- PermissionError
      |    +-- ProcessLookupError
      |    +-- TimeoutError
      +-- ReferenceError
      +-- RuntimeError
      |    +-- NotImplementedError
      +-- SyntaxError
      |    +-- IndentationError
      |         +-- TabError
      +-- SystemError
      +-- TypeError
      +-- ValueError
      |    +-- UnicodeError
      |         +-- UnicodeDecodeError
      |         +-- UnicodeEncodeError
      |         +-- UnicodeTranslateError
      +-- Warning
           +-- DeprecationWarning
           +-- PendingDeprecationWarning
           +-- RuntimeWarning
           +-- SyntaxWarning
           +-- UserWarning
           +-- FutureWarning
           +-- ImportWarning
           +-- UnicodeWarning
           +-- BytesWarning
           +-- ResourceWarning

Guess you like

Origin www.cnblogs.com/pengpenghuhu/p/11932828.html