mu-editor / mu

A small, simple editor for beginner Python programmers. Written in Python and Qt5.
http://codewith.mu
GNU General Public License v3.0
1.4k stars 434 forks source link

Can't get a file from esp32 #2461

Open uriyay opened 1 year ago

uriyay commented 1 year ago

What were you trying to do?

Copying a file from esp32 to my PC

What steps did you take to trigger the issue?

I tried to copy boot.py to my PC

What did you expect to happen?

The file should succeed writing to the PC

What actually happened?

I got an error, looking at the logs (and adding traceback info to base.py), I got this:

2023-09-10 11:23:36,068 - mu.interface.panes:784(dropEvent) INFO: Getting 'boot.py' from device. Copying to '<some path>\boot.py'.
2023-09-10 11:23:38,564 - mu.modes.base:706(get) ERROR: not enough values to unpack (expected 2, got 1)

2023-09-10 11:32:29,843 - mu.modes.base:708(get) ERROR: Traceback (most recent call last):
  File "C:\Users\Uriya\AppData\Local\Programs\Mu Editor\Python\lib\site-packages\mu\modes\base.py", line 703, in get
    microfs.get(device_filename, local_filename, serial=self.serial)
  File "C:\Users\Uriya\AppData\Local\Programs\Mu Editor\Python\lib\site-packages\mu\contrib\microfs.py", line 273, in get
    out, err = execute(commands, serial)
  File "C:\Users\Uriya\AppData\Local\Programs\Mu Editor\Python\lib\site-packages\mu\contrib\microfs.py", line 149, in execute
    out, err = response[2:-2].split(b"\x04", 1)  # Split stdout, stderr
ValueError: not enough values to unpack (expected 2, got 1)

It seems that the problem is that response doesn't contain '\x04' at all. Instead it contains the full file content:

ValueError: not enough values to unpack (expected 2, got 1), response = b'OK# This file is executed on every boot (including wake-boot from deepsleep)\n#import esp\n#esp.osdebug(None)\n#import webrepl\n#webrepl.start'

(Got it by adding response var to the exception message).

Perhaps the problem is with this line:

response = serial.read_until(b"\x04>")  # Read until prompt.

That reads until '\x04' not including? Also, something weird with the "OK" string. Maybe the problem is that my firmware is not compatible with Mu Editor?

Operating System Version

Windows 11

Mu Version

1.2

Other Info

ESP32 Firmware version: esp32-20230426-v1.20.0 (Downloaded from here

Editor Log

No response