Add exception catching
This commit is contained in:
		@@ -61,6 +61,7 @@ class Tracks(object):
 | 
				
			|||||||
        if filename not in self.__files:
 | 
					        if filename not in self.__files:
 | 
				
			||||||
            self.logger.info("Adding file %s.", filename)
 | 
					            self.logger.info("Adding file %s.", filename)
 | 
				
			||||||
            with open(filename, 'r') as f:
 | 
					            with open(filename, 'r') as f:
 | 
				
			||||||
 | 
					                try:
 | 
				
			||||||
                    self.__files.append(filename)
 | 
					                    self.__files.append(filename)
 | 
				
			||||||
                    gpx = gpxpy.parse(f)
 | 
					                    gpx = gpxpy.parse(f)
 | 
				
			||||||
                    for raw in gpx.tracks:
 | 
					                    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] = {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.__avg_speed[trk_year][trk_month] = self.__distance[trk_year][trk_month] / (self.__duration[trk_year][trk_month] / 3600)
 | 
				
			||||||
                    self.logger.info("Adding done.")
 | 
					                    self.logger.info("Adding done.")
 | 
				
			||||||
 | 
					                except Exception as exception:
 | 
				
			||||||
 | 
					                    # TODO: Add logging mechanism.
 | 
				
			||||||
 | 
					                    pass
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def years(self):
 | 
					    def years(self):
 | 
				
			||||||
        ret = None
 | 
					        ret = None
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user