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
{{ message }}
Repository navigation
OSError 28 with basic file write on version 2 microbit #779
yes it may be lack of file space my program is 20145 bytes.
Here's a copy it (tries to) run for 5 hours random sampling the circle radius 1 inscribed in a square to calculate pi. after about 2 or 3 hours micro python just freezes.
the animation on the screen stops which changes every 10 loops, in a REPL session there is no exception error and you cant ctrl-c to stop micro python
Thanks for the additional info @rhubarbdog!
Are you using the latest MicroPython releases? I haven't looked at the details yet, but could be related to microbit-foundation/micropython-microbit-v2#105 ? which should be fixed in the 2.1.0 and 1.1.0 releases.
At least from microbit-foundation/micropython-microbit-v2#105, the issue in that case explicitly about using the same filename, but the filesystem not sweeping and freeing any erased filesystem blocks, to be able to have enough free space to write a new file.
So if a programme was constantly writing a file, deleting it, writing to a different file name, deleting it, and repeat, then it would end up with the same problem.
However, this issue was fixed in MicroPython for micro:bit v1.1.0 and v2.1.0. Which version are you using?
now using version 2.1.0 beta of microbit.hex and the initial issue of
f =open("text.txt", "w")
f.write("message")
no longer causes OSError28 and my program to find pi completed a 4 hour run last night and has now been going for 12 hours so micropython freezing may not be an issue any more.
how ever now that i have to use microFS to to copy my program and class definition i am experiencing a lot of failures with the error message Expecting 2 values to unpack, only found 1 i don't believe this to be a microFS problem and there are still issues on a file system with a 17kb class definition of decimal numbers when replacing file names or finding free blocks. ntoll/microfs#38
I had an unfinished PR (from my personal account, this one is a work which I keep separated). I've push it as a draft PR in case you'd like to use that version in the meantime:
Activity
microbit-carlos commentedon Oct 24, 2022
Hi @rhubarbdog,
For issues that V2 specific they should be opened in https://github.com/microbit-foundation/micropython-microbit-v2/issues
However, I've tried this script in both V1 and V2 and works fine:
Would you be able to provide an example that fails? Ideally in a new issue in https://github.com/microbit-foundation/micropython-microbit-v2/issues ?
Thanks!
rhubarbdog commentedon Oct 24, 2022
it may be that i have a couple of huge bytearray's allocated. i'll try on a clean microbit
rhubarbdog commentedon Oct 24, 2022
yes it may be lack of file space my program is 20145 bytes.
Here's a copy it (tries to) run for 5 hours random sampling the circle radius 1 inscribed in a square to calculate pi. after about 2 or 3 hours micro python just freezes.
the animation on the screen stops which changes every 10 loops, in a REPL session there is no exception error and you cant
ctrl-cto stop micro pythonmicrobit.py.txt
microbit-carlos commentedon Oct 25, 2022
Thanks for the additional info @rhubarbdog!
Are you using the latest MicroPython releases? I haven't looked at the details yet, but could be related to microbit-foundation/micropython-microbit-v2#105 ? which should be fixed in the 2.1.0 and 1.1.0 releases.
rhubarbdog commentedon Oct 25, 2022
There may be an issue with replacing a file with the same name
microbit-carlos commentedon Oct 25, 2022
At least from microbit-foundation/micropython-microbit-v2#105, the issue in that case explicitly about using the same filename, but the filesystem not sweeping and freeing any erased filesystem blocks, to be able to have enough free space to write a new file.
So if a programme was constantly writing a file, deleting it, writing to a different file name, deleting it, and repeat, then it would end up with the same problem.
However, this issue was fixed in MicroPython for micro:bit v1.1.0 and v2.1.0. Which version are you using?
rhubarbdog commentedon Oct 25, 2022
i'm using version v2.0.0-beta.5 as shipped with
uflash, should it be fixed?microbit-carlos commentedon Oct 25, 2022
That's a very old version, I'd recommend downloading the hex from: https://github.com/microbit-foundation/micropython-microbit-v2/releases/tag/v2.1.0
And then transferring your
main.pyfile with microFS: https://github.com/ntoll/microfsOr the online micro:bit Python Editor, which is quite nice too, specially if using Chrome with WebUSB: http://python.microbit.org
rhubarbdog commentedon Oct 26, 2022
now using version 2.1.0 beta of microbit.hex and the initial issue of
no longer causes
OSError28and my program to find pi completed a 4 hour run last night and has now been going for 12 hours so micropython freezing may not be an issue any more.how ever now that i have to use microFS to to copy my program and class definition i am experiencing a lot of failures with the error message
Expecting 2 values to unpack, only found 1i don't believe this to be a microFS problem and there are still issues on a file system with a 17kb class definition of decimal numbers when replacing file names or finding free blocks. ntoll/microfs#38microbit-carlos commentedon Oct 26, 2022
Yes, that is an issue in microFS, also captured in:
I had an unfinished PR (from my personal account, this one is a work which I keep separated). I've push it as a draft PR in case you'd like to use that version in the meantime:
And I'll close this as resolved in the current release, thanks @rhubarbdog!