Dhanush R
Dhanush R

Reputation: 1

KeyError Traceback (most recent call last)

**from geopy.geocoders import Here
    exif = get_exif('earth_postcard_1599147372.jpg')
    geotags = get_geotagging(exif)
    coords = get_coordinates(geotags)
    geocoder = Here(apikey=os.environ['API_KEY'])
    print(geocoder.reverse("%s,%s" % coords))**



ERROR
KeyError                                  Traceback (most recent call last)
<ipython-input-13-baa26ae24e59> in <module>
      4 geotags = get_geotagging(exif)
      5 coords = get_coordinates(geotags)
----> 6 geocoder = Here(apikey=os.environ['API_KEY'])
      7 print(geocoder.reverse("%s,%s" % coords))

~\anaconda3\lib\os.py in __getitem__(self, key)
    677         except KeyError:
    678             # raise KeyError with the original key value
--> 679             raise KeyError(key) from None
    680         return self.decodevalue(value)
    681 

KeyError: 'API_KEY'

Here i try to get the location of using latitude and logitude using geopy library but im getting key error

Upvotes: 0

Views: 11300

Answers (1)

superman
superman

Reputation: 251

You should check whether you have set your environment parameter.You can enter into python command line mode then input :

import os
os.environ.keys()

System will output all the environment parameter."API_KEY" should not be set. If you set this key in system parameter list,this error will be gone.

Upvotes: 0

Related Questions