coddingtonbear / python-myfitnesspal

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

client.get_date() not working #37

Closed philliid closed 8 years ago

philliid commented 8 years ago

Hi, I have been using myfitnesspal package successfully for >9 months, I last used it 7 days ago with no problems. Today when I use it, I get the following error:

day = client.get_date(2016, 3, 2)

Traceback (most recent call last): File "<pyshell#0>", line 1, in day = client.get_date(current_date) File "C:\Python27\lib\site-packages\myfitnesspal\client.py", line 329, in get_date meals = self._get_meals(document) File "C:\Python27\lib\site-packages\myfitnesspal\client.py", line 285, in _get_meals value = self._get_numeric(column.text) File "C:\Python27\lib\site-packages\myfitnesspal\client.py", line 215, in _get_numeric return int(re.sub(r'[^\d.]+', '', string)) ValueError: invalid literal for int() with base 10: ''

I have updated to the latest version (v1.8.2). I am using python v2.7.11 Any suggestions?

pydolan commented 8 years ago

Looks like some of your data is missing a value for whatever reason (either you logged an item that is different from others, such as it is missing data for an attribute; or you logged an item without specifying an attribute; or MFP changed their web page). Depending on the problem, one fix would be to modify the _is_numeric() function to not convert to integer if the string variable is blank.

Be sure to submit a pull-request if you change the code for yourself.

philliid commented 8 years ago

Excellent. I can confirm that this now works. Thank you for your help