http Post error in pycom with pysense OSError: [Errno 113] ECONNABORTED



  • I have a problem in my code that sometime the post method is not working.
    and i am not sure why this is happen. Please guide me to the solution.

    //////////////////////////////Below is part of my code

    nets = wlan.scan()
    for net in nets:
        if net.ssid == wifiSsid:
            print('WiFi Network found, trying to login!')
            wlan.connect(net.ssid, auth=(net.sec, wifiPass), timeout=5000)
            time.sleep(3)
            while not wlan.isconnected():
                machine.idle() # save power while waiting
                print('WLAN connection succeeded!')
                break
    
    print("Starting... update server")
    time.sleep(2)
    
    while True:
        mp = MPL3115A2(py,mode=ALTITUDE) # Returns height in meters. Mode may also be set to PRESSURE, returning a value in Pascals
        si = SI7006A20(py)
        lt = LTR329ALS01(py)
        li = LIS2HH12(py)
        mpp = MPL3115A2(py,mode=PRESSURE)# Returns pressure in Pa. Mode may also be set to ALTITUDE, returning a value in meters
        t_ambient = 24.4
    
    
        relativeHumidity = str(si.humidity())
        print('relativeHumidity:'+relativeHumidity)
        altitude = str(mp.altitude())
        print('altitude:'+altitude)
        pressure = str(mpp.pressure())
        print('pressure:'+pressure)
        tempature = str(si.temperature())
        print('tempature:'+tempature)
        dew_point = str(si.dew_point())
        print('dew_point:'+dew_point)
        humid_ambient = str(si.humid_ambient(t_ambient))
        print('humid_ambient:'+humid_ambient)
        light = str(lt.light())
        light = light.replace(",", "_")
        light = light.replace(' ', '')
        light = light.replace('(', '')
        light = light.replace(')', '')
        print('light:'+light)
        Acceleration = str(li.acceleration())
        Acceleration = Acceleration.replace(",", "_")
        Acceleration = Acceleration.replace(' ', '')
        Acceleration = Acceleration.replace('(', '')
        Acceleration = Acceleration.replace(')', '')
        print('Acceleration:'+Acceleration)
        roll = str(li.roll())
        print('roll:'+roll)
        Pitch = str(li.pitch())
        print('Pitch:'+Pitch)
        batteryVoltage = str(py.read_battery_voltage())
        print('batteryVoltage:'+batteryVoltage)
    
    
    
        #below send message
    
        url = "here is my server URL sorry for cannot show"
    
        print("url:" + url)
        time.sleep(1)
        send_msg = urequests.post(url)
        print("send sucess contact")
        time.sleep(5)
    

    //////////////////////////////////Below is the error

    Traceback (most recent call last):
    File "main.py", line 123, in <module>
    File "/flash/lib/urequests.py", line 112, in post
    File "/flash/lib/urequests.py", line 97, in request
    File "/flash/lib/urequests.py", line 58, in request
    OSError: [Errno 113] ECONNABORTED



  • HI is there any people have any idea why would this happen????????


Log in to reply
 

Pycom on Twitter