Page 1 of 1

uasyncio frozen include

Posted: Sun Oct 15, 2017 1:12 am
by devnull
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 ??

Re: uasyncio frozen include

Posted: Sun Oct 15, 2017 8:16 am
by benalb
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.

Re: uasyncio frozen include

Posted: Sun Oct 15, 2017 8:34 am
by benalb
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                                                   

Re: uasyncio frozen include

Posted: Sun Oct 15, 2017 9:28 am
by pythoncoder
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

Re: uasyncio frozen include

Posted: Sun Oct 15, 2017 11:48 am
by devnull
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.

Re: uasyncio frozen include

Posted: Mon Oct 16, 2017 6:06 am
by benalb
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 :?: