IndexError in `user_genre_info` function when no genre data is available
Closed this issue · 4 comments
ret[genre] = [int(s) for s in data.split() if s.isdigit()][0]
It gives an error with my user (maybe because I didn't see any western movie)
I suggest replacing it by:
digit_list = [int(s) for s in data.split() if s.isdigit()]
if digit_list:
ret[genre] = digit_list[0]
else:
ret[genre] = 0
What is your error message and type?
Sorry
/letterboxdpy/user.py", line 183, in user_genre_info
ret[genre] = [int(s) for s in data.split() if s.isdigit()][0]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^
IndexError: list index out of range
If the length of the list [int(s) for s in data.split() if s.isdigit()] is equal to zero, the line will give you an error
For instance: I didn't watch any western movies, so the length of the list for that genre will be zero
Sorry!!
It isn't an issue anymore...
I've installed letterboxdpy from pypi. It downloaded version 4.5. And the error was in the 183 line of user.py
Now I just see this repository and the file was fixed!
So... the question is When will it be pypi updated