I've seen an OSError stack trace when trying to talk to an I2C device on the wrong address and wondered what EIO means. It would be nice to have a list of all the error codes and what they mean.
From what I've read, error numbers are different for each hardware port of MicroPython. I'm using a Raspberry PI PICO and can get a list like this:
MicroPython v1.24.1 on 2024-11-29; Raspberry Pi Pico with RP2040
Type "help()" for more information.
>>> import errno
>>> print(errno.errorcode)
{1: 'EPERM', 2: 'ENOENT', 5: 'EIO', 9: 'EBADF', 11: 'EAGAIN', 12: 'ENOMEM', 13: 'EACCES', 17: 'EEXIST', 19: 'ENODEV', 21: 'EISDIR', 22: 'EINVAL', 95: 'EOPNOTSUPP', 98: 'EADDRINUSE', 103: 'ECONNABORTED', 104: 'ECONNRESET', 105: 'ENOBUFS', 107: 'ENOTCONN', 110: 'ETIMEDOUT', 111: 'ECONNREFUSED', 113: 'EHOSTUNREACH', 114: 'EALREADY', 115: 'EINPROGRESS’}
But it doesn’t really tell much. They all start with ‘E' and so 'EIO' just means IO error, which makes sense.
In face they're all more readable if you know to drop the E.
{1: 'PERM',
2: 'NOENT',
5: 'IO',
9: 'BADF',
11: 'AGAIN',
12: 'NOMEM',
13: 'ACCES',
17: 'EXIST',
19: 'NODEV',
21: 'ISDIR',
22: 'INVAL',
95: 'OPNOTSUPP',
98: 'ADDRINUSE',
103: 'CONNABORTED',
104: 'CONNRESET',
105: 'NOBUFS',
107: 'NOTCONN',
110: 'TIMEDOUT',
111: 'CONNREFUSED',
113: 'HOSTUNREACH',
114: 'ALREADY',
115: 'INPROGRESS’}