You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
...
importerrno
...
try:
withopen("/textfile.txt", "a") asfp:
...
exceptOSErrorase:
print(e) # for example prints "[Errno 30] Read-only filesystem"ife.errno==30:
...
Behavior
The provided code works fine. The "print(e)" results in the string "[Errno 30] Read-only filesystem" and "if e.errno == 30" works as expected. But if I replace "30" with "errno.EROFS" (as described at https://docs.circuitpython.org/en/latest/docs/library/errno.html) I get "During handling of the above exception, another exception occurred" and "AttributeError: 'module' object has no attribute 'EROFS'".
Description
I would expect to have either both the string and enum (hopefully, since this is such a common error), or neither.
Additional information
See https://forums.adafruit.com/viewtopic.php?p=1032465 where this issue was discussed with Dan Halbert. Most important, I think the list of strings and list of enums in moderrno.c should agree and both include Read-Only File System. Less important (but it sure would have helped me), the documentation at https://docs.circuitpython.org/en/latest/docs/library/errno.html could be improved from "The codes available may vary per CircuitPython build" (please avoid disclaimers like this) to where to find the list that applies to my situation.
The text was updated successfully, but these errors were encountered:
Less important (but it sure would have helped me), the documentation at https://docs.circuitpython.org/en/latest/docs/library/errno.html could be improved from "The codes available may vary per CircuitPython build" (please avoid disclaimers like this) to where to find the list that applies to my situation.
CircuitPython version
Code/REPL
Behavior
The provided code works fine. The "print(e)" results in the string "[Errno 30] Read-only filesystem" and "if e.errno == 30" works as expected. But if I replace "30" with "errno.EROFS" (as described at https://docs.circuitpython.org/en/latest/docs/library/errno.html) I get "During handling of the above exception, another exception occurred" and "AttributeError: 'module' object has no attribute 'EROFS'".
Description
I would expect to have either both the string and enum (hopefully, since this is such a common error), or neither.
Additional information
See https://forums.adafruit.com/viewtopic.php?p=1032465 where this issue was discussed with Dan Halbert. Most important, I think the list of strings and list of enums in moderrno.c should agree and both include Read-Only File System. Less important (but it sure would have helped me), the documentation at https://docs.circuitpython.org/en/latest/docs/library/errno.html could be improved from "The codes available may vary per CircuitPython build" (please avoid disclaimers like this) to where to find the list that applies to my situation.
The text was updated successfully, but these errors were encountered: