Hi, I’ve started to work thru your course “MicroPython Programming with ESP32 and ESP8266″(order #105478). Great stuff!!
I’m using a D1 mini with ESP8266 and the Mu Editor on a Mac. Currently I’m trying to connect the ESP8266 to my local WiFi. However, following the instructions to replace the boot.py file on the board with the newly created one according to your script on pp. 200-209, I’m running into a problem. When I try to upload the newly created boot.py to the board and press ok to replace the existing one, Mu Editor freezes and shows an error that “there is a problem getting the list of files on the device”.
Your advice to resolve this problem would be much appreciated.
You need to burn micropython firmware and try again.
If you continue to have that kind of issue, I recommend trying a different IDE.
I had to burn the MicroPython firmware once more in order to use the file system again. And I could reproduce the problem. To me it looks like as if the problem is only related to boot.py. If I create just one main.py with all the code which you have suggested to split into two parts there is no problem. Do you have a suggestion of a workaround without a script named boot.py? That would allow me to continue with Mu Editor.
If it works better with only main.py, you can put all the code in that file.
For the examples presented, it doesn’t make much difference if all code is in main.py.
Thanks, I will move forward with that workaround.
Any chance to understand the root cause? It looks like as if the original boot.py on the board created by flashing the MicroPython firmware for ESP8266 must not be changed/replaced.
I’m not sure that might be the cause.
In some IDEs, like upycraft, for example, that error usually doesn’t happen.
Well, I started with your first recommendation, and uPyCraft crashes on my MB M2 with Ventura immediately when opening the program.
That’s so bad…
Unfortunately, there isn’t a “good” IDE for micropython. You need to try several and see which ones work best with your setup.
What about using just the main.py file? Did that solve any of your issues?
Using just the main.py is working if boot.py hasn’t been replaced before.
But still trying to understand what’s problem with the boot.py. This morning I started again, replaced boot.py on the device and couldn’t use the file system anymore. When I look into the log I found an OSError as follows
022-11-21 11:15:04,819 – mu.interface.panes:716(dropEvent) INFO: Copying ‘/Users/Hartmut/mu_code/boot.py’ to device.
2022-11-21 11:15:09,746 – mu.modes.base:693(ls) ERROR: Could not enter raw REPL.
Traceback (most recent call last):
File “/Applications/Mu Editor.app/Contents/Resources/Python/lib/python3.8/site-packages/mu/modes/base.py”, line 690, in ls
result = tuple(microfs.ls(self.serial))
File “/Applications/Mu Editor.app/Contents/Resources/Python/lib/python3.8/site-packages/mu/contrib/microfs.py”, line 185, in ls
out, err = execute([“import os”, “print(os.listdir())”], serial)
File “/Applications/Mu Editor.app/Contents/Resources/Python/lib/python3.8/site-packages/mu/contrib/microfs.py”, line 139, in execute
File “/Applications/Mu Editor.app/Contents/Resources/Python/lib/python3.8/site-packages/mu/contrib/microfs.py”, line 100, in raw_on
File “/Applications/Mu Editor.app/Contents/Resources/Python/lib/python3.8/site-packages/mu/contrib/microfs.py”, line 72, in flush_to_msg
raise IOError(“Could not enter raw REPL.”)
OSError: Could not enter raw REPL.
2022-11-21 11:15:09,789 – mu.interface.main:1047(show_message) DEBUG: There was a problem getting the list of files on the device. Please check Mu’s logs for technical information. Alternatively, try unplugging/plugging-in your device and/or restarting Mu.
2022-11-21 11:15:09,790 – mu.interface.main:1048(show_message) DEBUG: None
Could this be a usage error causing that OSError? Or any other idea or advice?
Apologies if this is not the right forum for these details.
To be honest, I’m not sure.
I think it is because the ESP starts running wherever there is on the boot or main files straight away. So, it becomes busy, and we cannot access it.
You can take a look at eh mu editor github page and see if there are any hints on the issues section: https://github.com/mu-editor/mu/