Skip to content

'import asyncio fails' on Unix Port, plus strange Unix task_handler.py Timer behaviour #538

@StephenDone

Description

@StephenDone

I have built the unix port VARIANT=standard and am running it under WSL2 on windows.
I have the test app running, as listed in the readme.md.

However,

>>> import asyncio
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: no module named 'asyncio'
>>> help('modules')
__main__          encoder_framework lvgl              sdl_pointer
_asyncio          errno             machine           select
_indev_base       ffi               math              socket
_thread           framebuf          micropython       ssl
argparse          fs_driver         mip/__init__      struct
array             gc                mip/__main__      sys
binascii          hashlib           os                task_handler
btree             heapq             platform          termios
builtins          i2c               pointer_framework time
button_framework  io                random            tls
cmath             io_expander_framework               re                touch_cal_data
collections       json              requests/__init__ touch_calibrate
cryptolib         keypad_framework  rgb_display_framework               uctypes
deflate           lcd_bus           sdl_display       vfs
display_driver_framework            lcd_utils         sdl_keyboard      websocket
Plus any modules on the filesystem

Copying lvgl_micropython/lib/micropython/extmod/asyncio/* to ~/.micropython/lib/asyncio looks like it might work. The import error goes away.

lvgl_micropython/lib/micropython/ports/unix/variants/standard/manifest.py looks as follows...

include("$(PORT_DIR)/variants/manifest.py")

include("$(MPY_DIR)/extmod/asyncio")

and lvgl_micropython/lib/micropython/extmod/asyncio/manifest.py as follows...

# This list of package files doesn't include task.py because that's provided
# by the C module.
package(
    "asyncio",
    (
        "__init__.py",
        "core.py",
        "event.py",
        "funcs.py",
        "lock.py",
        "stream.py",
    ),
    base_path="..",
    opt=3,
)

# Backwards-compatible uasyncio module.
module("uasyncio.py", opt=3)

I am just guessing, as this is not anything I've looked at before, but maybe the asyncio .py files are not being frozen into the build.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions