hardeepnarang10 / fb2ics

Scan saved facebook page for birthday information to generate importable ICS (calendar) file.
MIT License
24 stars 7 forks source link

Crash at line 37 of parser.py #4

Closed imranget closed 5 years ago

imranget commented 5 years ago

Crash occurs at this line - e.begin = f'{year}-{month}-{day} 00:00:00' indicating that month cannot be greater than 12.

Swapping the month & day in the tuple parsing on line 26 & 27 makes the code work. Need to check if the ICS contains the correct birthdays

hardeepnarang10 commented 5 years ago

Different locales have distinct date format. The way I see it, solving this will require either writing conditionals for each locale (or groups of locales) and hoping the user hasn't changed default formatting on their system, or by having users configure a .ini file with their local date format, which requires some tech knowledge on users' side.

I've decided against this change for now.

I'm happy to assist though if you're willing to contribute. Make a pull request.

Thanks for reporting @imranget Let me know if you find any different resolve.

hardeepnarang10 commented 5 years ago

Tip: It's better solved if python can fetch local date format on the system. Or use a different system to run the script, and import the file on google calender; which is not a solution but a workaround.

I'm leaving this thread open for now.

hardeepnarang10 commented 5 years ago

@imranget I've tested Version 2.0.0 on multiple timezones and I didn't encounter this issue at all. Changing date format on Windows 10 1903 x64 had no effect either. The program reported no such errors.

Can you test it again on your system? Make sure you clone the latest commit (9859147).

imranget commented 5 years ago

First of all thank you for this utility. This is the first time I actually edited Python code, I have no experience with this at all. I do have one suggestion - the locale can be an optional parameter in the command line. In case there is a crash with the error message the user can supply an alternative locale, is that something doable ?

hardeepnarang10 commented 5 years ago

Just added support for locale difference. Turns out it wasn't actually the locale which caused error. Facebook's async endpoints which scraper.py delivers data from, changes format over different timezones.

v2.1.1 delivers fix.

Also, I followed up on your suggestion to add argparser. Check help message using --help argument.

parser.py is now capable of resolving this issue on its own.

Again, thanks for reporting @imranget :)