coddingtonbear / python-myfitnesspal

Access your meal tracking data stored in MyFitnessPal programatically
MIT License
794 stars 138 forks source link

IndexError: list index out of range in _get_goals #69

Closed zagi closed 5 years ago

zagi commented 6 years ago

Hi, Sometimes I'm experiencing IndexError when calling get_date:

18:59:24 web.1    |     day = mfp_client.get_date(single_date)
18:59:24 web.1    |   File "/home/vagrant/envs/vagrant/lib/python2.7/site-packages/myfitnesspal/client.py", line 481, in get_date
18:59:24 web.1    |     goals = self._get_goals(document)
18:59:24 web.1    |   File "/home/vagrant/envs/vagrant/lib/python2.7/site-packages/myfitnesspal/client.py", line 235, in _get_goals
18:59:24 web.1    |     total_header = document.xpath("//tr[@class='total']")[0]
18:59:24 web.1    | IndexError: list index out of range

I'm preparing PR for this and will assign it with this issue.

Thanks, Mike

mtthwsar commented 5 years ago

@coddingtonbear I'm also having this issue.

zagi commented 5 years ago

@coddingtonbear thanks for merging! closing this one.