micropython / webrepl

WebREPL client and related tools for MicroPython
MIT License
632 stars 297 forks source link

OSError: [Errno 2] ENOENT #38

Open robmarkcole opened 6 years ago

robmarkcole commented 6 years ago

System: MicroPython v1.9.4-8-ga9a3caad0 on 2018-05-11; ESP module with ESP8266 Issue: unable to connect to the wifi point setup by the board and receive the following error on startup:

WebREPL daemon started on ws://192.168.4.1:8266
WebREPL daemon started on ws://0.0.0.0:8266
Started webrepl in normal mode
OSError: [Errno 2] ENOENT
Singein commented 6 years ago

is there a file named main.py?

robmarkcole commented 6 years ago

I didn't create one, but if that's the cause of the error would be good to catch that

Singein commented 6 years ago

I think the current mpy error requires some experience and imagination.

Singein commented 6 years ago

please see the issue #40,I really want to share with the community.

murilopolese commented 6 years ago

This is a "No such file or directory" error thrown by Python (and other languages):

https://docs.python.org/2/library/errno.html#errno.ENOENT

It means it tried to open a file that doesn't exist. I believe the ESP8266 port will always try to run the boot.py and main.py files on boot:

https://github.com/micropython/micropython/blob/master/ports/esp8266/main.c#L68-L71

inovatorius commented 1 year ago

MicroPython v1.20.0 on ESP8266

>>> import webrepl_setup
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "webrepl_setup.py", line 1, in <module>
  File "webrepl_setup.py", line 1, in main
  File "webrepl_setup.py", line 1, in get_daemon_status
OSError: [Errno 2] ENOENT

boot.py should be on the filesystem to avoid this error, see https://github.com/micropython/micropython-lib/blob/master/micropython/net/webrepl/webrepl_setup.py

f4grx commented 10 months ago

Please catch this exception with an indication that boot.py is required, or just accept the absence of boot.py

This makes quite a bad user experience to be greeted with an uncaught exception for such a simple non-blocking issue, in a setup assistant.

f4grx commented 10 months ago

Also, how hard would it be to use secure web sockets ? that would allow web browsers to use the https version of the webrepl client. it seems that ssl is available in micropython and ssl can be added to any protocol in just one line, like is done with mqtt:

https://github.com/micropython/micropython-lib/blob/master/micropython/umqtt.simple/umqtt/simple.py#L72