micropython / micropython/micropython

mpremote: unable to execute fs commands - mpremote.transport.TransportError: could not enter raw repl

Open
#16,142 8 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

bug tools
Dominant language
C
Stars
22.1k
Forks
9k
Avg merge
6d 4h
Merged PRs (30d)
16

Description

Port, board and/or hardware

esp32 wroom

MicroPython version

MicroPython v1.23.0 on 2024-06-02; Generic ESP32 module with ESP32
mpremote 1.24.0

Reproduction

mpremote fs ls failed with
mpremote.transport.TransportError: could not enter raw repl

Expected behaviour

expected

mpremote fs ls
ls :
           0 mrequests/
Observed behaviour
b'MicroPython v1.23.0 on 2024-06-02; Generic ESP32 module with ESP32\r\nType "help()" for more information.\r\n>>> '
Traceback (most recent call last):
  File "/opt/homebrew/bin/mpremote", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/opt/homebrew/lib/python3.11/site-packages/mpremote/main.py", line 538, in main
    handler_func(state, args)
  File "/opt/homebrew/lib/python3.11/site-packages/mpremote/commands.py", line 294, in do_filesystem
    state.ensure_raw_repl()
  File "/opt/homebrew/lib/python3.11/site-packages/mpremote/main.py", line 480, in ensure_raw_repl
    self.transport.enter_raw_repl(soft_reset=soft_reset)
  File "/opt/homebrew/lib/python3.11/site-packages/mpremote/transport_serial.py", line 139, in enter_raw_repl
    raise TransportError("could not enter raw repl")
mpremote.transport.TransportError: could not enter raw repl
Additional Information

My temporary workaround is additional time.sleep(1) at line
https://github.com/micropython/micropython/blob/0e490b7c8f32bb72c516985abe67147b9385dc34/tools/mpremote/mpremote/transport_serial.py#L125
before flush input.

Code of Conduct

Yes, I agree

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with tools/mpremote/mpremote/transport_serial.py around line 125 and trace the raw-REPL setup called by ensure_raw_repl from do_filesystem. Reproduce the failure with mpremote fs ls on the reported ESP32 and compare it with the additional one-second delay workaround. Done means filesystem commands enter the raw REPL reliably without that workaround.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
cli, embedded-iot
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.