urequests.get() error related to getaddrinfo
Hello:
I just compiled MicroPython for RPI Pico with WIZNET5k support as described here: https://github.com/Wiznet/RP2040-HAT-MicroPython
Ethernet connects and works.
However urequests gives this error:
request = urequests.get('http://bipes.net.br/test.txt')
Traceback (most recent call last):
File "<stdin>", line 14, in <module>
File "urequests.py", line 116, in get
File "urequests.py", line 55, in request
TypeError: function takes 2 positional arguments but 4 were given
I checked urequests.py and the implementation is:
ai = usocket.getaddrinfo(host, port, 0, usocket.SOCK_STREAM)
If I change this line to
ai = usocket.getaddrinfo(host, port)
The problem is solved and urequests.get() works!
However, I am uncertain if this would cause other boards/implementations problems.
Can this fix be applied to urequests.py, or it could break other network implementations?
thanks
ESP32 doesn't support full getaddrinfo() params
After installing the new version of picoweb and uasyncio, I noticed an error when calling app.run(). The error occurs because uasyncio init.py file contains a call to socket.getaddrinfo() with 4 arguments, when socket requires only 2. The error causes app.run() to fail.
I can't reproduce this.
I noticed that usocket.getaddrinfo only takes 2 arguments, but uasyncio
init.py file passes 4. Do u have the wrong version of usocket? I
can't find one that use 4 arguments.
I can confirm removing the second two arguments in the initial file worked
On Feb 5, 2018 10:31 AM, "Paul Sokolovsky" notifications@github.com wrote:
Sorry, I meant to say "do I have the wrong version of usocket?"
On Feb 5, 2018 10:35 AM, "Dylan Contris" dcontris@gmail.com wrote:
Possibly, you would need to tell what version of MicroPython on what hardware/OS you use.
Micropython for ESP32 with the 2-5 version binaries
On Feb 5, 2018 10:38 AM, "Paul Sokolovsky" notifications@github.com wrote:
See https://github.com/pfalcon/picoweb/issues/31
Thanks!
On Feb 5, 2018 11:05 AM, "Paul Sokolovsky" notifications@github.com wrote:
I have faced with the same error while trying to run
loop.create_task(asyncio.start_server(handle_client, ipAddress, 8080))Is there some solution about it?
Dear @pfalcon, How can i replace the current modsocket.c in esp32 with a update one in the link below?;
micropython/ports/esp32/modsocket.c
This should now be fixed by https://github.com/micropython/micropython/commit/cced43feb8ffee0791f82c0358265329347f88c7
Same error with request = urequests.post(requesturl, headers={"User-Agent": "Python/SomeUserAgent"})
Function takes only 2 positional arguments but four were given...
Full MicroPython traceback: