Author gvanrossum
Recipients gvanrossum, serhiy.storchaka, terry.reedy
Date 2019-05-06.12:38:01
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1557146281.66.0.862429600242.issue36807@roundup.psfhosted.org>
In-reply-to
Content
That board implements a USB filesystem that you plug into a computer (via a cable). The control software on the board watches this USB filesystem, and when the "code.py" file changes it reloads that file and executes it with CircuitPython (Adafruit's fork of MicroPython).

So the recommended workflow for the user is: edit the code to program a LED blinking pattern (for example); save the file; watch the LEDs on the board blink in the programmed pattern. Repeat with other changes. Endless fun.

Where IDLE currently doesn't cooperate is that after a save operation, the OS kernel doesn't immediately flush the bytes to the USB filesystem, so the board doesn't see the changes to the file until the OS cache gets flushed at the kernel's whim. (The board uses very low level fs operations because it's an 8-bit microprocessor with very little memory and therefore has very primitive software.)

The os.fsync() call ought to fix it by forcing the kernel to flush the bytes to the USB filesystem right away. This also helps when the user saves the file and immediately pulls out the USB cable. The OS will issue a warning in an attempt to train users to "Eject" first, but beginners are prone to making this mistake repeatedly.

Hope this helps. You should really watch @nnja's keynote once it goes online, it was really cool. :-)
History
Date User Action Args
2019-05-06 12:38:01gvanrossumsetrecipients: + gvanrossum, terry.reedy, serhiy.storchaka
2019-05-06 12:38:01gvanrossumsetmessageid: <1557146281.66.0.862429600242.issue36807@roundup.psfhosted.org>
2019-05-06 12:38:01gvanrossumlinkissue36807 messages
2019-05-06 12:38:01gvanrossumcreate