Add exception catching

This commit is contained in:
Thomas Klaehn 2020-10-12 17:53:16 +02:00
parent 320bab0188
commit 7a7d6dedf3

View File

@ -61,6 +61,7 @@ class Tracks(object):
if filename not in self.__files:
self.logger.info("Adding file %s.", filename)
with open(filename, 'r') as f:
try:
self.__files.append(filename)
gpx = gpxpy.parse(f)
for raw in gpx.tracks:
@ -81,6 +82,9 @@ class Tracks(object):
self.__avg_speed[trk_year] = {1: 0, 2: 0, 3: 0, 4: 0, 5: 0, 6: 0, 7: 0, 8: 0, 9: 0, 10: 0, 11: 0, 12: 0}
self.__avg_speed[trk_year][trk_month] = self.__distance[trk_year][trk_month] / (self.__duration[trk_year][trk_month] / 3600)
self.logger.info("Adding done.")
except Exception as exception:
# TODO: Add logging mechanism.
pass
def years(self):
ret = None