errno – system error codes
This module provides access to symbolic error codes for OSError exception,
along with the errorcode dictionary mapping numeric codes back to
their symbolic names. The particular inventory of codes depends on the
MicroPython port.
Constants
- EEXIST, EAGAIN, etc.
Error codes, based on ANSI C/POSIX standard. All error codes start with “E”. As mentioned above, inventory of the codes depends on MicroPython port. Errors are usually accessible as
exc.errnowhereexcis an instance ofOSError. Usage example:try: os.mkdir("my_dir") except OSError as exc: if exc.errno == errno.EEXIST: print("Directory already exists")