get_exercise: invalid literal for int() with base 10: ''
See original GitHub issueWhen I attempt to use the get_exercise code, I get the following error.
>>> import myfitnesspal
>>> client = myfitnesspal.Client('********', '********')
>>> client.get_exercise(2017,9,1)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "myfitnesspal\client.py", line 432, in get_exercise
exercise = self._get_exercise(document)
File "myfitnesspal\client.py", line 381, in _get_exercise
value = self._get_numeric(column.text)
File "myfitnesspal\client.py", line 220, in _get_numeric
return int(re.sub(r'[^\d.]+', '', string))
ValueError: invalid literal for int() with base 10: ''
I believe it’s related to the fact that my iPhone syncs my step data in and returns N/A for minutes, which means that the re.sub… in _get_numeric is returning an empty string to int()
I can fix this, but I already have a pull request open and I’m unsure semantically if it makes more sense to check in _get_numeric and return 0 for blank strings or whether the get_exercise should be parsing for entirely non-numeric content before calling _get_numeric
Issue Analytics
- State:
- Created 6 years ago
- Comments:9 (7 by maintainers)
Top Results From Across the Web
ValueError: invalid literal for int() with base 10: '' - Stack Overflow
ValueError: invalid literal for int() with base 10: '' · 2. For anyone currently looking here. The error may be that one of...
Read more >ValueError: invalid literal for int() with base 10
The error message invalid literal for int() with base 10 would seem to indicate that you are passing a string that's not an...
Read more >ValueError: invalid literal for int() with base 10 in Python
The Python "ValueError: invalid literal for int() with base 10" occurs when we pass a string that cannot be directly converted to an...
Read more >Python ValueError: invalid literal for int() with base 10
This error can frequently occur when converting user-input to an integer-type using the int() function. This problem happens because Python stores the input...
Read more >Python ValueError: invalid literal for int() with base 10 Solution
Our error message tells us there is an invalid literal for an integer in base 10. This means the value we have passed...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Released @jgissend10’s fix as part of 1.11.0; sorry for the delay!
Ahh; hrm – sorry about that; I’ll push out a new release later today!