OSError 5 in code.py

CircuitPython on hardware including Adafruit's boards, and CircuitPython libraries using Blinka on host computers.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
edoarado
 
Posts: 3
Joined: Wed Dec 01, 2021 3:09 pm

OSError 5 in code.py

Post by edoarado »

Hi

My CLUE shows an "OSError: [Errno 5] error Input/output" (Spanish version of circuitPython 7.0) in the "code.py" file.
I'm unable to run any program and everything I tried to modify or delete the code.py file was unsuccessful.
I reloaded the circuitPython UF2 but nothing changed.

Mu editor shows a message to run "chkdsk" to check for corrupt data, but I don't know how to proceed.
I'm running Windows 10 and Linux Mint 20.2 Cinnamon.

Thanks in advance for any help.

User avatar
danhalbert
 
Posts: 4613
Joined: Tue Aug 08, 2017 12:37 pm

Re: OSError 5 in code.py

Post by danhalbert »

Try erasing and reformatting the filesystem by typing this in the REPL:

Code: Select all

import storage
storage.erase_filesystem()
The board will reset and you will have a fresh CIRCUITPY. Then save your code.py again as usual.

What editor are you using?

User avatar
edoarado
 
Posts: 3
Joined: Wed Dec 01, 2021 3:09 pm

Re: OSError 5 in code.py

Post by edoarado »

Thanks danhalbert

Your code worked like a charm. Problem solved.

The editor I was using when the problem appeared was Mu under Windows 10.

Again, thank you very much.

User avatar
danhalbert
 
Posts: 4613
Joined: Tue Aug 08, 2017 12:37 pm

Re: OSError 5 in code.py

Post by danhalbert »

Glad it's working!

If you reset the board before a write has been completed, it can cause the CIRCUITPY to become corrupted. If you copied a file to to CIRCUITPY with Explorer, or something besides the editor, Windows might only partially update the drive. It can sometimes take tens of seconds to update. Doing an "Eject" forces out everything right away. Mu does the right thing and also forces everything out right away.

User avatar
edoarado
 
Posts: 3
Joined: Wed Dec 01, 2021 3:09 pm

Re: OSError 5 in code.py

Post by edoarado »

Thanks again for your clarification.
I don't remember doing anything wrong, but ... who knows.

I will keep that in mind.

Best regards

Locked
Please be positive and constructive with your questions and comments.

Return to “Adafruit CircuitPython”