wendlers / mpfshell

A simple shell based file explorer for ESP8266 Micropython based devices ⛺
MIT License
396 stars 84 forks source link

Not usable anymore on Circuitpython #60

Closed Tasm-Devil closed 3 years ago

Tasm-Devil commented 5 years ago

It is not your fault, but it seams that adafruit made some changes in their circuitpython code. See here: https://github.com/adafruit/circuitpython/issues/1029 I get the same error when i try to connect to a circuitpython board. Could u fix this, plz

junhuanchen commented 5 years ago

yep. This problem is originated from the firmware you use, since neither ubinascii or binascii, should be the system's own, if you don't have this module, you can try to import it, first in repl or from other place to make up for, have no way to add this to the underlying mpfshell interface.

skorokithakis commented 5 years ago

Is this still a problem? Not quite sure how to solve it, since I don't have a CircuitPython board.

stlehmann commented 5 years ago

We could tackle this by trying to import the modules ubinascci and uos and if this fails we go for binascci and os. Another idea would be to check if it is micropython or circuitpython and change the imports accodingly. I'll give it a try.

skorokithakis commented 5 years ago

The former sounds like a good solution, try to import the first two and if there's an ImportError, fall back to the other two.

skorokithakis commented 5 years ago

It looks like this is what the code does already. Can you clarify to me what the bug is, why it's caused and which packages are available on which board?

skorokithakis commented 5 years ago

I've pushed a change that tries os as uos, can you see if that works and let me know?

stlehmann commented 5 years ago

I've pushed a change that tries os as uos, can you see if that works and let me know? Yes, this seems to work now.

But there is another problem with binascii. I just discovered that circuitpython does not provide either a binascii or a ubinascii module.

skorokithakis commented 5 years ago

Ah, that seems rather harder to fix. The solution for this is the same as in #69, which is to use binary mode to transfer files.

stlehmann commented 5 years ago

Adafruit makes the following statement in their Circuit Python documentation:

Some libraries are only enabled only WiFi-capable ports (ESP8266, nRF) because they are typically used for network software: binascii, hashlib, uheapq, uselect, ussl. Not all of these are enabled on all WiFi-capable ports.

That explain why mpfshell doesn't work on the Feather M0. Apparently one would need to enable the binascii module in the firmware before uploading it.