You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
After successfully geocoding locations of linkedin connections, one cannot save the connections data into json. The reported error after running the cell is the following:
#Save the processed data
CONNECTIONS_DATA = 'linkedin_connections.json'
# Loop over contacts and update the location information to store the
# string address, also adding latitude and longitude information
def serialize_contacts(contacts, output_filename):
for c in contacts:
location = c['Location']
if location != None:
# Convert the location to a string for serialization
c.update([('Location', location.address)])
c.update([('Lat', location.latitude)])
c.update([('Lon', location.longitude)])
f = open(output_filename, 'w')
f.write(json.dumps(contacts, indent=1))
f.close()
return
serialize_contacts(contacts, CONNECTIONS_DATA)
in serialize_contacts(contacts, output_filename)
9 if location != None:
10 # Convert the location to a string for serialization
---> 11 c.update([('Location', location.address)])
12 c.update([('Lat', location.latitude)])
13 c.update([('Lon', location.longitude)])
AttributeError: 'str' object has no attribute 'address'
The text was updated successfully, but these errors were encountered:
After successfully geocoding locations of linkedin connections, one cannot save the connections data into json. The reported error after running the cell is the following:
AttributeError Traceback (most recent call last)
in
16 f.close()
17 return
---> 18 serialize_contacts(contacts, CONNECTIONS_DATA)
in serialize_contacts(contacts, output_filename)
9 if location != None:
10 # Convert the location to a string for serialization
---> 11 c.update([('Location', location.address)])
12 c.update([('Lat', location.latitude)])
13 c.update([('Lon', location.longitude)])
AttributeError: 'str' object has no attribute 'address'
The text was updated successfully, but these errors were encountered: