I've been using python for a while but I still run into elementary problems. I'm currently using exifread library in python to get latitude and longitude. I need to convert the DMS values to DD.
So far I have written the following:
#!/bin/python
import math
import exifread
path_name = './IMAG0658.jpg'
f = open(path_name, 'rb')
tags = exifread.process_file(f)
GPSLat = tags['GPS GPSLatitude']
print tags['GPS GPSLatitudeRef']
print GPSLat.values[0]
print GPSLat.values[1]
print GPSLat.values[2]
GPSDDLat = GPSLat.values[0] + ((GPSLat.values[1] / 60) + (GPSLat.values[2]/3600))
print GPSDDLat
However it crashes after printing the following:
$python tempexif.py
N
33
52
433621/10000
Traceback (most recent call last):
File "tempexif.py", line 14, in <module>
GPSDDLat = GPSLat.values[0] + ((GPSLat.values[1] / 60) + (GPSLat.values[2]/3600))
TypeError: unsupported operand type(s) for /: 'instance' and 'int'
How do I do math against the list values rather than the object itself?