Skip to content

fix loading code file with '>>>' string - #560

Closed
FoamyGuy wants to merge 1 commit into
circuitpython:mainfrom
FoamyGuy:fix_code_loading_issue
Closed

fix loading code file with '>>>' string#560
FoamyGuy wants to merge 1 commit into
circuitpython:mainfrom
FoamyGuy:fix_code_loading_issue

Conversation

@FoamyGuy

@FoamyGuy FoamyGuy commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

This fixes an issue that causes opening a file to fail if the file contains ">>>" in a string. I believe that some part of the logic is getting that confused for the REPL prompt even if it is in a string literal.

Fixed by transferring the contents of the file in base64 instead of raw.

Thested successfully on a ESP32-C6 with by opening a file that contains print("hello >>> world")

@makermelissa

Copy link
Copy Markdown
Collaborator

That makes sense because it goes through serial for that device, which uses circuitpython-repl-js. It needs to be more reliable because this is the favored way to open files.

@makermelissa

Copy link
Copy Markdown
Collaborator

I don't think this is the correct fix because in certain situations, you want the text to be returned only and not the raw file. I need to look further, but the correct fix likely needs to be in https://github.com/adafruit/circuitpython-repl-js with mechanisms to only look for >>> in the right situations.

@makermelissa-ai-assistant

Copy link
Copy Markdown
Contributor

I traced this to the raw REPL response parser and opened adafruit/circuitpython-repl-js#25 with a fix and regression tests.

_checkCodeRunning() was calling _detectCurrentMode() before parsing each raw response. Since mode detection searches the accumulated serial buffer for >>> and other prompt strings, text printed as raw stdout could be mistaken for a mode transition. The new PR keeps an active raw response under the documented OK / stdout / Ctrl-D / stderr / Ctrl-D / > framing and also handles OK split across serial chunks.

With that fixed in the library, this web-editor change should not need to route all text reads through the binary/base64 path and Blob.text().

@makermelissa

Copy link
Copy Markdown
Collaborator

Closing in favor of adafruit/circuitpython-repl-js#25 and #561.

@makermelissa

Copy link
Copy Markdown
Collaborator

The root-cause fix should be live in a couple minutes if you'd like to give it a test.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants