joenano / rpscrape

Scrape horse racing results data and racecards.
143 stars 59 forks source link

Racecard.py fetch failing #55

Closed HyperFail closed 3 years ago

HyperFail commented 3 years ago

Hello there,

When calling the racecard.py either for today or tomorrow, I am seeing the below error. This started occurring on 19th May.

Traceback (most recent call last): File "C:\scripts\racecards.py", line 426, in <module> main() File "C:\scripts\racecards.py", line 416, in main races = parse_races(session, race_docs) File "C:\scripts\racecards.py", line 321, in parse_races going_info = get_going_info(session) File "C:\scripts\racecards.py", line 62, in get_going_info going, rail_movements = parse_going(course['going']) File "C:\scripts\racecards.py", line 255, in parse_going info = going_info.split(going)[1] ValueError: empty separator

gbettle commented 3 years ago

I also found the error - it's in get_going_info().

When you look at today's rp page (https://www.racingpost.com/non-runners/) there is a an Arab-only race opening the day at Chelmsford.

It's at the bottom of the page. Crucially, it's missing a "going".

This is how I got it to work again:

for course in json.loads(json_str):
    _going = course['going']
    if not _going: continue 
    going, rail_movements = parse_going(course['going'])
joenano commented 3 years ago

They have added the going in now for that meeting, and the error should be handled in future.

HyperFail commented 3 years ago

Yep, all working now. Thanks for sorting so quickly.