OSError: [Errno 202] EAI_FAIL

  • Hi
    i'm trying to use the urequests module that i found here : https://github.com/micropython/micropython-lib/blob/master/urequests/urequests.py
    but i've got an error :

    eerno 1.jpg

    In the MAIN.py i use a firebase module where all starts

    eerno 0.jpg

    the FIREBASE.py file

    eerno 00.jpg

    the UREQUEST file

    eerno 2.jpg

    eerno 3.jpg

  • Do you wait in the boot.py until the connection is established, or simply use wlan.connect(...) and then end the file?
    As far as I know, the statement you mention should be true, and the connection you made in the boot.py file should hold.
    You should be able to test this though, through using

    from network import WLAN
    wlan = WLAN()

    in the main.py to test if we are connected to a wifi network. If this returns false, there is no connection. This should also hold True if the connection was created in previous 'session' that you ctrl+c'd out of, which is, to my understanding, very similar to the transfer between boot.py and main.py.

  • I found the problem, it was because i tried the urequest without connected to WIFI but i don't understand because i wrote the connection code on the boot.py butt it only works when i write the connection code on the main.py
    it's not normal , i think

    eerno 1.jpg

  • I don't use pycom vodafone.
    i'm working with the wipy3 and i connect it to internet through the wifi.

    i'm going to check the DNS server
    i'll come back

  • The EAI_FAIL is related to not being able to resolve the DNS. This means that, for whichever network you are using, the nameserver (like google.com) cannot be resolved to an IP address because the DNS server cannot be reached. This is thus related to the network not being connected to the internet, or the DNS server is not set correctly.

    If you are using a pycom vodafone simcard over a NB-IoT connection, this is an expected result, as the simcards are only meant for connections to pybytes.

    You can check the DNS server setting through using import socket; socket.dnsserver()

    Let me know

Log in to reply

Pycom on Twitter