when i try to run the example programms from io-client-python on my Raspberry PI 3B+ i get the following error:
Code: Select all
Traceback (most recent call last):
File "/home/pi/.local/lib/python3.5/site-packages/urllib3/connection.py", line 171, in _new_conn
(self._dns_host, self.port), self.timeout, **extra_kw)
File "/home/pi/.local/lib/python3.5/site-packages/urllib3/util/connection.py", line 56, in create_connection
for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM):
File "/usr/lib/python3.5/socket.py", line 733, in getaddrinfo
for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno -3] Temporary failure in name resolution
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/pi/.local/lib/python3.5/site-packages/urllib3/connectionpool.py", line 600, in urlopen
chunked=chunked)
File "/home/pi/.local/lib/python3.5/site-packages/urllib3/connectionpool.py", line 343, in _make_request
self._validate_conn(conn)
File "/home/pi/.local/lib/python3.5/site-packages/urllib3/connectionpool.py", line 849, in _validate_conn
conn.connect()
File "/home/pi/.local/lib/python3.5/site-packages/urllib3/connection.py", line 314, in connect
conn = self._new_conn()
File "/home/pi/.local/lib/python3.5/site-packages/urllib3/connection.py", line 180, in _new_conn
self, "Failed to establish a new connection: %s" % e)
urllib3.exceptions.NewConnectionError: <urllib3.connection.VerifiedHTTPSConnection object at 0x75bbda10>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/pi/.local/lib/python3.5/site-packages/requests/adapters.py", line 445, in send
timeout=timeout
File "/home/pi/.local/lib/python3.5/site-packages/urllib3/connectionpool.py", line 638, in urlopen
_stacktrace=sys.exc_info()[2])
File "/home/pi/.local/lib/python3.5/site-packages/urllib3/util/retry.py", line 398, in increment
raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='io.adafruit.com', port=443): Max retries exceeded with url: /api/v2/luke_5k/feeds/location/data (Caused by NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x75bbda10>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution',))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/pi/io-client-python/examples/basics/location.py", line 52, in <module>
aio.send_location_data(location.key, value, lat, lon, ele)
File "/home/pi/.local/lib/python3.5/site-packages/Adafruit_IO/client.py", line 151, in send_location_data
return self.create_data(feed, Data(value = value,lat=lat, lon=lon, ele=ele))
File "/home/pi/.local/lib/python3.5/site-packages/Adafruit_IO/client.py", line 206, in create_data
return Data.from_dict(self._post(path, data._asdict()))
File "/home/pi/.local/lib/python3.5/site-packages/Adafruit_IO/client.py", line 102, in _post
data=json.dumps(data))
File "/home/pi/.local/lib/python3.5/site-packages/requests/api.py", line 112, in post
return request('post', url, data=data, json=json, **kwargs)
File "/home/pi/.local/lib/python3.5/site-packages/requests/api.py", line 58, in request
return session.request(method=method, url=url, **kwargs)
File "/home/pi/.local/lib/python3.5/site-packages/requests/sessions.py", line 512, in request
resp = self.send(prep, **send_kwargs)
File "/home/pi/.local/lib/python3.5/site-packages/requests/sessions.py", line 622, in send
r = adapter.send(request, **kwargs)
File "/home/pi/.local/lib/python3.5/site-packages/requests/adapters.py", line 513, in send
raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPSConnectionPool(host='io.adafruit.com', port=443): Max retries exceeded with url: /api/v2/luke_5k/feeds/location/data (Caused by NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x75bbda10>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution',))
i received this error by using the loaction.py Program:
Code: Select all
"""
'location.py'
====================================
Example of sending GPS data points
to an Adafruit IO Feed using the API
Author(s): Brent Rubell, Todd Treece
"""
# Import standard python modules
import time
# Import Adafruit IO REST client.
from Adafruit_IO import Client, Feed, RequestError
# Set to your Adafruit IO key.
# Remember, your key is a secret,
# so make sure not to publish it when you publish this code!
ADAFRUIT_IO_KEY = 'MYKEY'
# Set to your Adafruit IO username.
# (go to https://accounts.adafruit.com to find your username)
ADAFRUIT_IO_USERNAME = 'MYUSERNAME'
# Create an instance of the REST client.
aio = Client(ADAFRUIT_IO_USERNAME, ADAFRUIT_IO_KEY)
# Assign a location feed, if one exists already
try:
location = aio.feeds('location')
except RequestError: # Doesn't exist, create a new feed
feed = Feed(name="location")
location = aio.create_feed(feed)
# limit feed updates to every 3 seconds, avoid IO throttle
loop_delay = 5
# We dont' have a GPS hooked up, but let's fake it for the example/test:
# (replace this data with values from a GPS hardware module)
value = 0
lat = 40.726190
lon = -74.005334
ele = 6 # elevation above sea level (meters)
while True:
print('\nSending Values to location feed...\n')
print('\tValue: ', value)
print('\tLat: ', lat)
print('\tLon: ', lon)
print('\tEle: ', ele)
# Send location data to Adafruit IO
aio.send_location_data(location.key, value, lat, lon, ele)
# shift all values (for test/demo purposes)
value += 1
lat -= 0.01
lon += -0.02
ele += 1
# Read the location data back from IO
print('\nData Received by Adafruit IO Feed:\n')
data = aio.receive(location.key)
print('\tValue: {0}\n\tLat: {1}\n\tLon: {2}\n\tEle: {3}'
.format(data.value, data.lat, data.lon, data.ele))
# wait loop_delay seconds to avoid api throttle
time.sleep(loop_delay)
Does anyone knows why this error occurs? Thank you very much!
BANNED