Page 1 of 1

Micropython on Linux, problen with *.mpy

Posted: Fri Mar 26, 2021 5:12 pm
by Alex_III
Compiled on Ubuntu, it works.
I wanted to install a library uasyncio.

Code: Select all

alex@ub2:~/micropython$ ./python -m upip install micropython-uasyncio
Installing to: /home/alex/.micropython/lib/
Installing micropython-uasyncio 3.0 from https://micropython.org/pi/uasyncio/uasyncio-3.0.tar.gz

alex@ub2:~$ ls ~/.micropython/lib/uasyncio
core.mpy  __init__.mpy  stream.mpy  task.mpy
Run program
I get an error.

Code: Select all

Traceback (most recent call last):
  File "/home/alex/PycharmProjects/pythonProject/main.py", line 16, in <module>
ValueError: incompatible .mpy file

Re: Micropython on Linux, problen with *.mpy

Posted: Sat Mar 27, 2021 3:56 pm
by scruss
Yes, I found that too. Looks like the upip mpy files haven't been regenerated.

I removed the ~/.micropython/lib/uasyncio folder, then copied uasyncio's source from the extmod tree:

Code: Select all

cp -r extmod/uasyncio ~/.micropython/lib
That seemed to allow the module to at least load:

Code: Select all

./micropython 
MicroPython v1.14-122-g9fef1c0bd on 2021-03-27; linux version
Use Ctrl-D to exit, Ctrl-E for paste mode
>>> import uasyncio
>>> dir(uasyncio)
['__class__', '__getattr__', '__name__', '__file__', '__path__', 'sleep', 'sleep_ms', 'sys', 'ticks_add', 'ticks_diff', 'core', '__version__', '_attrs', 'wait_for', 'funcs', 'gather', 'Event', 'event', 'Lock', 'ticks', 'select', 'TaskQueue', 'Task', 'task', 'CancelledError', 'TimeoutError', 'SingletonGenerator', 'IOQueue', 'create_task', 'run_until_complete', 'run', 'Loop', 'get_event_loop', 'current_task', 'new_event_loop']
>>> 

Re: Micropython on Linux, problen with *.mpy

Posted: Sat Mar 27, 2021 4:09 pm
by kevinkk525
or build micropython-dev for the unix port which includes uasyncio. (And complain on github so uasyncio gets finally merged in the non-dev unix port...)