I am unable to use Pandas on a Python 2.7 environment.
I am appending all output into a new file using the csv library.
I am having to use Visual Code, which appears a bit fuzzy.
Yesterday, I didn't get any errors with the same code???
Now I am getting a writer error:
writer.writerow(row)
File "C:\python38\lib\csv.py", line 154, in writerow
return self.writer.writerow(self._dict_to_list(rowdict))
File "C:\python38\lib\csv.py", line 147, in _dict_to_list
wrong_fields = rowdict.keys() - self.fieldnames
AttributeError: 'list' object has no attribute 'keys'
I would appreciate any pointers.
Thanks,
Clive
I am appending all output into a new file using the csv library.
I am having to use Visual Code, which appears a bit fuzzy.
Yesterday, I didn't get any errors with the same code???
Now I am getting a writer error:
writer.writerow(row)
File "C:\python38\lib\csv.py", line 154, in writerow
return self.writer.writerow(self._dict_to_list(rowdict))
File "C:\python38\lib\csv.py", line 147, in _dict_to_list
wrong_fields = rowdict.keys() - self.fieldnames
AttributeError: 'list' object has no attribute 'keys'
I would appreciate any pointers.
Thanks,
Clive
##### START
for filename in glob.glob(Path+'\*.jpg'):
#print(filename)
with open(latlongfile, 'w' ) as csvfile:
#### Get Filename, lat/Long
#### Returns: Latitude, Longitude and Altitude
geo_tag = gpsphoto.getGPSData(filename)
#reader = csv.DictReader(csvfile)
print(geo_tag)
latitude = geo_tag.get('Latitude')
longitude = geo_tag.get('Longitude')
#for row in reader:
print(row['filename'], row['latitude'], row['longitude'])
#print(filename, latitude, longitude)
writer = csv.DictWriter(csvfile, headersCSV)
# Pass the data in the dictionary as an argument into the writerow() function
writer.writerow(row)
# Close the file object
csvfile.close()
#### END
