Error Parsing Header in MRC file
Opened this issue · 1 comments
mattystevens commented
Running mrc_to_wahoo_plan.py on this file generates this trace.
File "mrc_to_wahoo_plan.py", line 35, in <module>
mrc = Mrc.load_mrc_file(filename)
File "/Users/matthewstevens/git/mrcTool/mrc/mrc.py", line 124, in load_mrc_file
return cls(raw_mrc)
File "/Users/matthewstevens/git/mrcTool/mrc/mrc.py", line 9, in __init__
self.course_header = self.parse_course_header()
File "/Users/matthewstevens/git/mrcTool/mrc/mrc.py", line 16, in parse_course_header
return MrcHeader.from_raw_course_header(raw_header)
File "/Users/matthewstevens/git/mrcTool/mrc/mrc_header.py", line 42, in from_raw_course_header
if data[0] != "MINUTES":
IndexError: list index out of range
4minshortrecovery.mrc
[COURSE HEADER]
VERSION = 2
UNITS = ENGLISH
DESCRIPTION = 4min-short recovery
FILE NAME = 4minshortrecovery - ergdb
MINUTES PERCENT
[END COURSE HEADER]
[COURSE DATA]
0.00 50
5.00 50
5.00 70
9.00 70
9.00 50
10.00 50
10.00 70
14.00 70
14.00 50
15.00 50
15.00 75
19.00 75
19.00 50
20.00 50
20.00 75
24.00 75
24.00 50
25.00 50
25.00 80
29.00 80
29.00 50
30.00 50
30.00 80
34.00 80
34.00 50
35.00 50
35.00 85
39.00 85
39.00 50
40.00 50
40.00 85
44.00 85
44.00 50
45.00 50
45.00 90
49.00 90
49.00 50
50.00 50
50.00 90
54.00 90
54.00 50
55.00 50
55.00 50
59.00 50
[END COURSE DATA]
mattystevens commented
Additional Info.
This is caused by a blank line in the header after DESCRIPTION.
If the DESCRIPTION text entered in ERGdb/TrainerDay contains a newline at the end, this will be carried over into the .MRC and break the parsing.
Removing this blank line from the .mrc header allowed the task to complete.