Closed evanjs closed 6 years ago
Thanks for catch that.
Well... this is indeed not a valid date and need to be to parse correctly here: api.py. There a couple of ways to fix that. As this is about how MAL works, I think we should not close the whole application because of that or give any error about it. Because is not a error of MyAnimeList, is a feature (how the PHP developers say, they say). The design is wrong, but that is other history.
A simple strategy to implement one fix for that is keep the raw date untouched, as 2011-05-00
in your case, if a exception is signalized. Or to avoid try/exception blocks, just split by -
and check if some of the tokens are a 0 filled string.
As you see, methods with decorator @checked_regex
and @checked_connection
on api.py
did handle exceptions very well, but I did not write a special case for date format on _fdate
because I didn't even know that MyAnimeList would be send even MORE TYPES of invalid date here.
Anyway, the MAL API... what are they thinking to put a invalid date to store a information of a PARTIAL-DATE?. :/ well, as the MAL API is so wrong in so many levels, this is not even a surprise...
Just one thing, I know are you using the PS prompt of Windows, but Ctrl-C
doesn't send a SIGINT signal and close the application when the application throw a exception? Are you tested that?
I don't have sure if Windows implement the POSIX signals, although Windows is not a POSIX system at all.
I implemented a simple fix just for you on date-fix
feature branch.
Please, reinstall your mal application with that command:
pip install git+https://www.github.com/ryukinix/mal.git@date-fix
Give me a feedback if this works for you.
Yeah, scratch the interrupt statement. Ctrl+C works fine on Gentoo (4.13.4). Fix seems to work:
PS C:\Users\evanjs> mal filter 'Naruto.*' --extend
Matched 3 items:
1: Naruto
Completed at 220/220 episodes with score 10
Started: 03-04-2011 Finished: NA
Tags: ナルト
2: Naruto x UT
Completed at 1/1 episodes with score 10
Started: NA Finished: NA
Tags: None
3: Naruto: Shippuuden
Watching at 387/500 episodes with score 9
Started: 2011-05-00 Finished: NA
Tags: ナルト疾
Nice to hear about it.
MyAnimeList allows the user to enter a partial date for start and end date. When the python client (mal) sees this, it throws a ValueError exception.
Example date: 05/00/2011 Command:
mal filter 'tex.*' --extend
ValueError: time data '2011-05-00' does not match format '%Y-%m-%d'
After changing the suspect entries to "Unknown Date" on MyAnimeList (which seems to just blank the dates out), this issue seems to be fixed.
No idea how this should be handled, but I figure anything is better than what currently happens: the error is thrown, the process does not halt, and cannot be interrupted, forcing the user to close the window/tab in which mal is running.