micropython / micropython-lib

Core Python libraries ported to MicroPython
Other
2.31k stars 985 forks source link

uasyncio: ImportError: no module named 'uselect' on Pycom LoPy ESP32 #241

Closed stroobandt closed 11 months ago

stroobandt commented 6 years ago

As a newbee, I am still confused about when to use the u prefix in module names. I got the following error when trying out the uasyncio module:

File "/flash/lib/uasyncio/__init__.py", line 2, in <module>
ImportError: no module named 'uselect'

Neither was upip of any help:

$ ./micropython -m upip install uselect
Installing to: /home/serge/.micropython/lib/
Warning: pypi.python.org SSL certificate is not validated
Error installing 'uselect': Package not found, packages may be partially installed
stroobandt commented 6 years ago

Importing select instead of uselect in __init__.py resolves that issue, but then I get stuck on utimeq in core.py:

File "/flash/lib/uasyncio/core.py", line 2, in <module>
ImportError: no module named 'utimeq'
MicroPython 2ac6da2 on 2017-12-18; LoPy with ESP32
dpgeorge commented 6 years ago

This is really an issue for Pycom/LoPy: the LoPy is not an official MicroPython board and it's up to Pycom to provide support for uasyncio.

stroobandt commented 6 years ago

I understand. Again sorry, I am still trying to find my way amongst the different MicroPython camps, so to say. The following answer was received from the uasyncio developer on the MicroPython forum:

I think you've uncovered a build problem with certain platforms. uselect is provided by a C module (extmod/moduslect.c) so this needs to be specified in the makefile.

Your best recourse is to raise issues on GitHub with the platform maintainers, which I see you've done against the ESP32. I'm unfamiliar with the PyCom boards and whether their firmware will automatically pick up fixes applied to the official ESP32 port.

To be honest, it is all a bit confusing when one was not there from the beginning. More so, — correct me if I am wrong — when I read that you do occasional work for Pycom. Perhaps a brief text up on micropython.org explaining the differences would be helpful. It all reminds me of the times when many dialects of BASIC were popular.

Anyhow, I better stick to the limited set of MicroPython features the Pycom microcosmos has on offer when developing for that board and complain over there when necessary…

danicampora commented 6 years ago

Hi, I just noticed this thread. We’ll get this fixed soon. The select module should be accesible using the uselect name as well. We’ll work on full support for asyncio as well but this might take a bit more time.

Cheers, Daniel

stroobandt commented 6 years ago

Thanks, that would solve the uselect issue! Coincidentally, this uselect as well as the utimeq issue were both raised today by someone else over at the Pycom forum.

Damien is absolutely right of course, the utimeq issue pertains to the Pycom MicroPython variant. A Pycom bug report was opened and the utimeq discussion will continue over there.

nevercast commented 6 years ago

@stroobandt I'm using a WiPy2 from Pycom, with the latest firmware built from their github. import utimeq and import uselect both seem to resolve to available modules. Do you want to give this a check on your end too?