Manage socket timeout error
This commit is contained in:
parent
ff87b1877a
commit
b96ecd0605
@ -15,6 +15,7 @@ import time
|
||||
# import urllib library
|
||||
import urllib.request
|
||||
import urllib.error
|
||||
import socket
|
||||
|
||||
# import json
|
||||
import json
|
||||
@ -104,14 +105,22 @@ def main(meteobridge_url, meteobridge_user, meteobridge_passwd, max_host, max_po
|
||||
except urllib.error.URLError as e:
|
||||
if debug_urllib_print:
|
||||
print('URL Error Reason: ', e.reason)
|
||||
logging.error("Get sensor datas from : " + meteobridge_url + " - URL Error Reason: " + str(e.reason))
|
||||
error_counter += 1
|
||||
send_osc_message(oscSender, osc_error_addr, OSC_meteobridge_url_error)
|
||||
# msg = osc_message_builder.OscMessageBuilder(address = "/env_sensors/anemometer/error")
|
||||
# msg.add_arg(OSC_meteobridge_url_error)
|
||||
# oscSender.send(msg.build())
|
||||
# Sleep 5 seconds if error
|
||||
time.sleep(5)
|
||||
|
||||
if isinstance(e.reason, socket.timeout):
|
||||
logging.error("Socket timed out from : " + meteobridge_url + " - URL Error Reason: " + str(e.reason))
|
||||
error_counter += 1
|
||||
send_osc_message(oscSender, osc_error_addr, OSC_meteobridge_url_error)
|
||||
time.sleep(5)
|
||||
|
||||
else:
|
||||
logging.error("Get sensor datas from : " + meteobridge_url + " - URL Error Reason: " + str(e.reason))
|
||||
error_counter += 1
|
||||
send_osc_message(oscSender, osc_error_addr, OSC_meteobridge_url_error)
|
||||
# msg = osc_message_builder.OscMessageBuilder(address = "/env_sensors/anemometer/error")
|
||||
# msg.add_arg(OSC_meteobridge_url_error)
|
||||
# oscSender.send(msg.build())
|
||||
# Sleep 5 seconds if error
|
||||
time.sleep(5)
|
||||
|
||||
else:
|
||||
try:
|
||||
|
Loading…
Reference in New Issue
Block a user