Page 2 of 2

Re: Problem with uasyncio running picoweb - TypeError: function takes 2 positional arguments but 3 were given

Posted: Sat Feb 02, 2019 10:26 pm
by pfalcon
eltomek wrote:
Sat Feb 02, 2019 9:32 pm
File "uasyncio/__init__.py", line 60, in remove_writer
TypeError: function takes 2 positional arguments but 3 were given
MicroPython v1.10-188-gf1644bca9 on 2019-02-02; ESP module with ESP8266
Yes, that looks like a bug. Thanks for the report and detailed info, please run "git pull --rebase" and try the latest version.
Type "help()" for more information.

Anyone could try it to confirm it works? What's even more, when running app with Debug=1 I additionally get:
ImportError: no module named 'logging'
And this unfortunately lacks the detailed traceback info like above, so it's hard to tell what may be involved. So, let me just say "cannot reproduce".

Re: Problem with uasyncio running picoweb - TypeError: function takes 2 positional arguments but 3 were given

Posted: Sat Feb 02, 2019 11:05 pm
by eltomek
Thanks @pfalcon!
I did the update and it works ok now. I can see you have pushed quite a lot of commits today, thanks!

$ git pull --rebase
remote: Enumerating objects: 196, done.
remote: Counting objects: 100% (196/196), done.
remote: Compressing objects: 100% (95/95), done.
remote: Total 196 (delta 101), reused 196 (delta 101), pack-reused 0
Receiving objects: 100% (196/196), 35.22 KiB | 655.00 KiB/s, done.
Resolving deltas: 100% (101/101), completed with 3 local objects.
From https://github.com/pfalcon/pycopy
+ f1644bca9...ec2bf2fe0 pfalcon -> origin/pfalcon (forced update)
First, rewinding head to replay your work on top of it...

However, I need to turn debugging off (app.run(debug=-1)), otherwise I get:
PYB: soft reboot
scandone
Connection successful
('192.168.0.87', '255.255.255.0', '192.168.0.1', '62.179.1.62')
Traceback (most recent call last):
File "main.py", line 67, in <module>
File "picoweb/__init__.py", line 283, in run
ImportError: no module named 'logging'
MicroPython v1.10-189-gec2bf2fe0 on 2019-02-02; ESP module with ESP8266
Type "help()" for more information.

Looks like despite importing ulogging as logging, the picoweb still needs logging library. I am running a bit updated example https://github.com/pfalcon/picoweb/blob ... _webapp.py so that you may not match the line numbers.
File "main.py", line 67, in <module>
in my file is
app.run(debug=1, host=station.ifconfig()[0])

The doc says:
"The default value for debug parameter is 0 however, in which case picoweb will use ulogging module (on which your application needs to depend, again)."
However, with app.run(debug=0) or app.run() micropython throws an ImportError: no module named 'logging' too (despite importin ulogging as logging). Is that ok?

Anyway, the web server finally works now, thank you for the great project and for support!

Re: Problem with uasyncio running picoweb - TypeError: function takes 2 positional arguments but 3 were given

Posted: Sun Feb 03, 2019 6:52 am
by pfalcon
eltomek wrote:
Sat Feb 02, 2019 11:05 pm
Thanks @pfalcon!
I did the update and it works ok now. I can see you have pushed quite a lot of commits today, thanks!
My fork is rebased on top of mainline regularly (i.e. contains all that mainline contains), and that's how rebases look - a lot of metadata seems to be updated, but the content is the same.
[]
Traceback (most recent call last):
File "main.py", line 67, in <module>
File "picoweb/__init__.py", line 283, in run
ImportError: no module named 'logging'
MicroPython v1.10-189-gec2bf2fe0 on 2019-02-02; ESP module with ESP8266
Type "help()" for more information.
D'oh, that's what good testing and reports mean. Turns out, the 1.5.2 release of picoweb with the conversion to ulogging was sitting in my tree, not pushed to PyPI. Dunno how it happened - whether I was without the Internet at that time or PyPI itself was down. And I test mostly using MicroPython unix port these days, running it either against git tree, or against full micropython-lib, so that was missed, yeah.

Anyway, released picoweb 1.5.2 now, please give it a try, everything is intended to work out of the box of course.

Btw, uasyncio and picoweb have their own dedicated threads, if you spot any further issues, feel free to post there. I noticed this thread by a chance.

Re: Problem with uasyncio running picoweb - TypeError: function takes 2 positional arguments but 3 were given

Posted: Sun Feb 03, 2019 4:06 pm
by davlefou
Hi, to solved for ulogging you can do that in __init__.py of picoweb:
def run(self, host="127.0.0.1", port=8081, debug=-1, lazy_init=False, log=None)

et for uasyncia in __init__.py in "def remove_writer(self, sock):"
udpate that self.poller.unregister(sock, False)
bay:
try:
self.poller.unregister(sock, False)
except:
print('Echec unregister')

It not well but it work.

Re: Problem with uasyncio running picoweb - TypeError: function takes 2 positional arguments but 3 were given

Posted: Mon Feb 04, 2019 2:46 pm
by davlefou
And it is the same problem with esp32 card.

Re: Problem with uasyncio running picoweb - TypeError: function takes 2 positional arguments but 3 were given

Posted: Tue Feb 12, 2019 9:57 pm
by eltomek
pfalcon wrote:
Sun Feb 03, 2019 6:52 am
Anyway, released picoweb 1.5.2 now, please give it a try, everything is intended to work out of the box of course
Worked as a charm, many thanks!