CTHRU / Hitrava

Convert your Huawei Health sport activities and import them in Strava.
Other
352 stars 34 forks source link

KeyError: 'distance' #24

Closed RobinTH90 closed 4 years ago

RobinTH90 commented 4 years ago

Hi,

was tracking a "free training" session today with my Huawei Watch GT2. So the tracked session only contains time and heart rate and no distance. Trying to convert gets me an error:

C:\Users\Robin\Desktop\Hitrava-3.5.3>python Hitrava.py --file C:\Users\Robin\Desktop\Hitrava-3.5.3\HiTrack_1598967061000159896887100030001 2020-09-01 16:33:54,825 - INFO - main - Hitrava version 3.5.3 (build 2008.1801) started with arguments ['--file', 'C:\Users\Robin\Desktop\Hitrava-3.5.3\HiTrack_1598967061000159896887100030001'] 2020-09-01 16:33:54,825 - INFO - main - Running on Python version 3.8.5 2020-09-01 16:33:54,827 - INFO - parse - Parsing file <C:\Users\Robin\Desktop\Hitrava-3.5.3\HiTrack_1598967061000159896887100030001> 2020-09-01 16:33:54,830 - ERROR - generate_xml - Error generating TCX XML content for activity 'distance' Traceback (most recent call last): File "Hitrava.py", line 1451, in generate_xml self._generate_walk_run_cycle_xml_data(el_activity) File "Hitrava.py", line 1513, in _generate_walk_run_cycle_xml_data el_lap = self._generate_lap_header_xml_data(el_activity, segment) File "Hitrava.py", line 1617, in _generate_lap_header_xml_data el_distance_meters.text = str(segment['distance']) KeyError: 'distance'

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "Hitrava.py", line 1981, in main() File "Hitrava.py", line 1941, in main tcx_activity.save(tcx_filename) File "Hitrava.py", line 1642, in save self.generate_xml() File "Hitrava.py", line 1505, in generate_xml raise Exception('Error generating TCX XML content for activity <%s>\n%s', self.hi_activity.activity_id, e) Exception: ('Error generating TCX XML content for activity <%s>\n%s', 'HiTrack_1598967061000159896887100030001', KeyError('distance'))

worked fine so far with all my biking sessions with distance in it. Thanks in advance