OSError: in error.log file



  • I have created an error.log file to find errors.
    Enclosed is an excerpt of the file and below that the Main-File line.
    Who can help more and tell what these error messages mean and how I can avoid them?

    25.12.2019;05:10:21
    Traceback (most recent call last):
    File "main.py", line 790, in <module>
    File "/flash/lib/urequests.py", line 116, in post
    return request("POST", url, **kw)
    File "/flash/lib/urequests.py", line 102, in request
    raise
    File "/flash/lib/urequests.py", line 60, in request
    s.connect(ai[-1])
    OSError: [Errno 113] EHOSTUNREACH

    Main Zeile:
    res = urequests.post(url, data=json.dumps(userdata))

    25.12.2019;05:21:30
    Traceback (most recent call last):
    File "main.py", line 270, in <module>
    File "/flash/lib/urequests.py", line 113, in get
    return request("GET", url, **kw)
    File "/flash/lib/urequests.py", line 102, in request
    raise
    File "/flash/lib/urequests.py", line 62, in request
    s = ussl.wrap_socket(s, server_hostname=host)
    OSError: [Errno -26624] MBEDTLS_ERR_SSL_TIMEOUT

    Main Zeile:
    res = urequests.get(settings.Gateway+'onlinesettings.txt')

    25.12.2019;05:44:25
    Traceback (most recent call last):
    File "main.py", line 296, in <module>
    File "/flash/lib/urequests.py", line 113, in get
    File "/flash/lib/urequests.py", line 102, in request
    File "/flash/lib/urequests.py", line 62, in request
    OSError: [Errno -26624] MBEDTLS_ERR_SSL_TIMEOUT

    Main Zeile:
    res3 = urequests.get(settings.Gateway+'onoff.txt')

    25.12.2019;05:47:11
    Traceback (most recent call last):
    File "main.py", line 790, in <module>
    File "/flash/lib/urequests.py", line 116, in post
    return request("POST", url, **kw)
    File "/flash/lib/urequests.py", line 102, in request
    raise
    File "/flash/lib/urequests.py", line 62, in request
    s = ussl.wrap_socket(s, server_hostname=host)
    OSError: [Errno -26624] MBEDTLS_ERR_SSL_TIMEOUT

    Main Zeile:
    res = urequests.post(url, data=json.dumps(userdata))



  • @jcaron Many thanks for your info



  • @Wolli01 I believe the errors are self-explanatory.

    • The first one is “host unreachable”, which points to a network issue

    • The other one are timeouts during the TLS negotiation. That’s again most likely a network issue.

    Wireless communication is subject to all kinds of issues which makes it not 100% reliable, this is to be expected and managed. When an error occurs, you should retry, either right away (usually with a slight pause which increases each time, a random offset, and a limit to the number of retried), or through some queuing mechanism. The details depend a lot on how important the data is, what kind of delay you can accept, the frequency and size of the transmissions, your dependence on battery, and so on.



  • Awesome ! Many thanks 😊



  • @svonbentzel
    Yes, please.

    try: # Ab hier beginnt die Fehlerüberwachung
    

    #Code........................

    # Fehler abfangen und in die error.log speichern------------------------------
    except Exception as e:
        # Fehler Lampe in Rot anzeigen!
        pycom.rgbled(0xFF0000) #Rot
        # Fehler Lampe in Rot anzeigen!
        print("Fehlermeldung")
        print(e)
        # Fehlerdatei erstellen
        import sys 
        with open ('/sd/error.log', 'a') as f: 
        #Fehlerbeschreibung--------------------
            f.write(str(LogDateTime) + "\n")           
            sys.print_exception(e, f)
            f.write("\n")         
        #Fehlerbeschreibung--------------------
    
        time.sleep(10)
        machine.reset() # Neustarten
        #machine.deepsleep (1000)


  • @Wolli01

    Hello, can you share your code to generate this log file? I try it a few times and don’t get it :-(

    Please 🥺


Log in to reply
 

Pycom on Twitter