uasyncio frozen include

All ESP8266 boards running MicroPython.
Official boards are the Adafruit Huzzah and Feather boards.
Target audience: MicroPython users with an ESP8266 board.
Post Reply
User avatar
devnull
Posts: 473
Joined: Sat Jan 07, 2017 1:52 am
Location: Singapore / Cornwall
Contact:

uasyncio frozen include

Post by devnull » Sun Oct 15, 2017 1:12 am

I'm trying to test picoweb and are struggling to get usayncio loaded as a frozen module.

There are several related folders in micropython-lib:

uasyncio.core
uasyncio
uasyncio.queues

and when I create a symbolic link to what appears to be the main folder "uasyncio", I get a compile error:

Code: Select all

MPY modules/uasyncio/benchmark/boom_uasyncio.py
Traceback (most recent call last):
  File "modules/uasyncio/benchmark/boom_uasyncio.py", line 29
SyntaxError: invalid syntax
make: *** [../py/mkrules.mk:117: build/frozen_mpy/uasyncio/benchmark/boom_uasyncio.mpy] Error 1
So how exactly can I include asyncio as a frozen module ??

User avatar
benalb
Posts: 25
Joined: Fri May 19, 2017 1:23 pm

Re: uasyncio frozen include

Post by benalb » Sun Oct 15, 2017 8:16 am

same error here, I have edited modules/uasyncio/benchmark/boom_uasyncio.py:

from

Code: Select all

 25     if cnt == NUM_REQS:
 26         seen.sort()
 27         print
 28         print seen 
 29         print
 30         el = None
to

Code: Select all

 25     if cnt == NUM_REQS:
 26         seen.sort()
 27         print('')
 28         print(seen)
 29         print('')
 30         el = None
and then, make clean, make. It compiles, will try to flash.

User avatar
benalb
Posts: 25
Joined: Fri May 19, 2017 1:23 pm

Re: uasyncio frozen include

Post by benalb » Sun Oct 15, 2017 8:34 am

Ok, it flashed, but still can't make picoweb run:

Code: Select all

Traceback (most recent call last):                                                                                               
  File "<stdin>", line 1, in <module>                                                                                            
  File "/lib/picoweb/__init__.py", line 236, in run                                                                              
AttributeError: 'module' object has no attribute 'get_event_loop'                                                                
The same error if, instead of frozen module, try to install uasyncio with upip.

Code: Select all

>>> upip.install("picoweb")                                                                                                      
Installing to: /lib/                                                                                                             
Installing picoweb 1.2.2 from https://pypi.python.org/packages/22/be/7e7cabe1ac2607d849557314f8e48f6d9e0c13c64c47029ae250e9020942/picoweb-1.2.2.tar.gz
Error installing 'micropython-uasyncio': , packages may be partially installed                                                   

User avatar
pythoncoder
Posts: 5956
Joined: Fri Jul 18, 2014 8:01 am
Location: UK
Contact:

Re: uasyncio frozen include

Post by pythoncoder » Sun Oct 15, 2017 9:28 am

Re freezing uasyncio
Your modules directory should contain the following:
errno.py
logging.py
Plus a usayncio dircetory containing:
__init__.py
core.py
queues.py
Peter Hinch
Index to my micropython libraries.

User avatar
devnull
Posts: 473
Joined: Sat Jan 07, 2017 1:52 am
Location: Singapore / Cornwall
Contact:

Re: uasyncio frozen include

Post by devnull » Sun Oct 15, 2017 11:48 am

Thanks, yes I figured that out earlier this afternoon.

But this server seems to suffer with the same problem that all the others I have tried suffer from, it appears to go offline when there's no activity for some time.

User avatar
benalb
Posts: 25
Joined: Fri May 19, 2017 1:23 pm

Re: uasyncio frozen include

Post by benalb » Mon Oct 16, 2017 6:06 am

devnull wrote:
Sun Oct 15, 2017 11:48 am
[...] it appears to go offline when there's no activity for some time.
Just for test, I'v left a wemos d1 with a helloworld script overnight, and this morning the server is up and running. Maybe worth to share your code :?:

Post Reply