Closed gbettle closed 3 years ago
I cant replicate this error, can you print the info variable on error and post here. Cheers
I just noticed that your error shows info.split('rail movements:') on line 260 but the actual code is info.split('Rail movements:') with the capital R, not sure how youve got a lower case there but that will likely be the issue.
Yeah, sorry about that. Cheers, G.
From Windows 10:
rpscrape\scripts>python racecards.py today
Traceback (most recent call last): File "racecards.py", line 416, in
main()
File "racecards.py", line 406, in main
races = parse_races(session, race_docs)
File "racecards.py", line 311, in parse_races
going_info = get_going_info(session)
File "racecards.py", line 63, in get_going_info
going, rail_movements = parse_going(course['going'])
File "racecards.py", line 260, in parse_going
rail_movements = [x.strip() for x in info.split('rail movements:')[1].strip().strip(')').split(',')]
IndexError: list index out of range
The line before in file "racecards.py", line 259, in parse_going is:
if 'rail movements' in info.lower():
And therefore, I think line 260 should be changed to:
rail_movements = [x.strip() for x in info.lower().split('rail movements:')[1].strip().strip(')').split(',')]