SD Card write error: OSError: [Errno 5] EIO

  • I am getting this error when I am trying to log exception on my SD card.
    This is my code:

    sd = SD()


        with open('/sd/debug.log', 'a') as f:
            f.write('starting loop')
    except Exception as e:
       with open('/sd/error.log', 'w') as errorFile:

    My SD Card is a 32GB Fat32 formatted card, and I can successfully read the debug.log file on my mac.
    I don't understand why the second write in the error.log failed ... any help would be appreciated ...

  • @robert-hh In my main loop, I have simulated an Exception with

    raise Exception

    But it's working when I am writing to /flash/error.log, thanks for the tip. I just want to let my lopy running for a week and wanted some feedback if an exception have occured.

  • @geda For trial, I replaced the mainloop() by a 1/0 statement, just to cause an exception,, and all worked a expected. So maybe the error which happens in your test case has an impact on SD card I/O. What happens if you try writing to /flash/error.log instead?

Log in to reply

Pycom on Twitter

Looks like your connection to Pycom Forum was lost, please wait while we try to reconnect.