location = geolocator.geocode(" ".join(address.values()))
if location.longitude is not None:
node['pos'] = [location.longitude, location.latitude]
Don't understand way I'm still getting this error:
File "/home/easypc/Documents/Udacity_nano_degree/Data_Wrangling/audit_vilnius.py", line 167, in shape_element
if location.longitude is not None:
AttributeError: 'NoneType' object has no attribute 'longitude'
It is the location
variable itself that is None
, test for that too:
if location is not None and location.longitude is not None:
or perhaps more simply put:
if location: