try:from esp32 import Partition as pimport micropythonexcept ImportError:print("SKIP")raise SystemExit# try some vanilla OSError to get std error codetry:open("this filedoesnotexist", "r")print("FAILED TO RAISE")except OSError as e:print(e)# try to make nvs partition bootable, which ain't gonna workpart = p.find(type=p.TYPE_DATA)[0]fun = p.set_boottry:fun(part)print("FAILED TO RAISE")except OSError as e:print(e)# same but with out of memory condition by locking the heapexc = "FAILED TO RAISE"micropython.heap_lock()try:fun(part)except OSError as e:exc = emicropython.heap_unlock()print("exc:", exc) # exc empty due to no memory# same again but having an emergency buffermicropython.alloc_emergency_exception_buf(256)exc = "FAILED TO RAISE"micropython.heap_lock()try:fun(part)except Exception as e:exc = emicropython.heap_unlock()print(exc)
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。