-
Notifications
You must be signed in to change notification settings - Fork 25
Description
CircuitPython Version
CircuitPython 9.2.8
Raspberry Pi Pico
Workflow(s)
USB
Browser(s)
Google Chrome Version 138.0.7204.98 (Official Build) (64-bit)
Windows 11
Console Log
index.js:32 Uncaught (in promise) TypeError: Cannot read properties of null (reading 'readOnly')
at Wu.open (index.js:32:93023)
at RR.saveFileDialog (index.js:112:6199)
at RR.saveFileAs (index.js:112:5645)
at HTMLButtonElement.<anonymous> (index.js:118:11847)
When trying to recreate this, I got some different errors. The connect attempt suceeded, but saving hung with these errors in the console:
index.js:118 write failed InvalidStateError: An operation that depends on state cached in an interface object was made but the state had changed since it was read from disk. undefined
sy @ index.js:118
await in sy
saveFile @ index.js:112
jb @ index.js:118
await in jb
(anonymous) @ index.js:118
index.js:118 write failed TypeError: Cannot read properties of undefined (reading 'split')
at PR._splitPath (index.js:115:3146)
at PR.writeFile (index.js:115:2960)
at async cT.writeFile (index.js:93:8639)
at async RR.showBusy (index.js:112:4411)
at async RR.writeFile (index.js:112:6345)
at async sy (index.js:118:16147) TypeError: Cannot read properties of undefined (reading 'split')
at PR._splitPath (https://code.circuitpython.org/assets/js/index.js:115:3146)
at PR.writeFile (https://code.circuitpython.org/assets/js/index.js:115:2960)
at async cT.writeFile (https://code.circuitpython.org/assets/js/index.js:93:8639)
at async RR.showBusy (https://code.circuitpython.org/assets/js/index.js:112:4411)
at async RR.writeFile (https://code.circuitpython.org/assets/js/index.js:112:6345)
at async sy (https://code.circuitpython.org/assets/js/index.js:118:16147)
sy @ index.js:118
setTimeout
sy @ index.js:118
await in sy
saveFile @ index.js:112
jb @ index.js:118
await in jb
(anonymous) @ index.js:118
Steps
- Connect the RP2040 device to the computer with USB. I'm using a Raspberry Pi Pico 2.
- Make sure it's mounted read only. This can happen intermittently if you unplug the pico without ejecting. You can force the drive to be readonly in windows with the diskpart utility:
DISKPART> list disk
Disk ### Status Size Free Dyn Gpt
-------- ------------- ------- ------- --- ---
Disk 0 Online 953 GB 0 B *
Disk 1 Online 1024 KB 0 B
DISKPART> select disk 1
Disk 1 is now the selected disk.
DISKPART> attributes disk set readonly
- Now use the 'Connect' button on the code.circuitpython.org IDE. Sometimes it will connect sucessfully, other times you'll just get part of the flow completed with the first exception:

- If that succeeds, try editing code.py on the device and saving it. You will get the second set of exceptions as it tries to write the file.
NOTE: That readonly attribute will stick if you unmount and remount the drive. If you are trying to clear the readonly flag, use diskpart again.
DISKPART> select disk 1
DISKPART> attributes disk clear readonly
Description
Looks like the code just doesn't expect read-only filesystems in more than one place. An acceptable solution would to just handle this and pop up an alert. Better would be to give some advice as it can be a common problem when working with novice users. Using Mu, I've had this problem where students don't cleanly eject the Pico and it becomes read-only often. The solution is to remount and properly eject and sometimes run a filesystem check.
Additional information
I am willing to help work on the project if you are looking for contributors. Please hit me up on Discord and we can chat.
I started looking at the IDE and writing up what I'd like to see for use with our students.