python - I got an error : socket error [Errno -3] Temporary failure in name resolution -


this code:

import serial import time import socket ip = str('url') port = int(6090) err = 0 try:     mysocket = socket.socket(socket.af_inet, socket.sock_stream)     mysocket.connect((ip, port))     while 1:         arduino = serial.serial('/dev/ttyacm0', 9600)         sensorvalue = arduino.readline()         mysocket.sendall(sensorvalue) except socket.error, msg:     mysocket.close()     print 'socket error', msg mysocket.close 

after run program, got message "socket error [errno -3] temporary failure in name resolution". can me solve problem?

the root issue /etc/resolv.conf read @ python startup. force refresh of resolve table, can run (on linux):

import ctypes libc = ctypes.cdll.loadlibrary('libc.so.6') res_init = libc.__res_init res_init() 

Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -