micropython-nanoweb icon indicating copy to clipboard operation
micropython-nanoweb copied to clipboard

Slight syntax difference breaks example.py on the Pico W

Open joewez opened this issue 2 years ago • 2 comments

The example.py file does not run correctly on a Pico W because the sys.implementation function returns _mpy which does not match the current value being returned... mpy. Not sure how this should be handled.

joewez avatar Aug 28 '22 15:08 joewez

Not sure it is a Nanoweb related problem.

Could you send an example ?

hugokernel avatar Sep 28 '22 09:09 hugokernel

As an absolute novice in this area I can't contribute any more than the fact that today I have also been trying to run the example on Pico W and I'm also seeing 'mpy' errors, e.g.: Task exception wasn't retrieved future: <Task> coro= <generator object 'handle' at 20025020> Traceback (most recent call last): File "uasyncio/core.py", line 1, in run_until_complete File "nanoweb.py", line 153, in handle File "nanoweb.py", line 108, in generate_output File "", line 66, in wrapper File "", line 85, in api_status AttributeError: 'tuple' object has no attribute 'mpy'

gramps2022 avatar Sep 29 '22 17:09 gramps2022

The current implementation of MicroPython on the Pico W seems to expect _mpy instead of mpy in the sys.* library, as per the MicroPython docs

Change "sys.implementation.mpy" to "sys.implementation._mpy" on line 73 of example.py and it all works fine for me on the Pico W without exceptions, and displays and updates the system info as it should.

upython_rp2_nanoweb

chrisbie77 avatar Dec 07 '22 15:12 chrisbie77