eInkCalendar
eInkCalendar copied to clipboard
datetime: offset-naive and offset-aware
I'm giving this a shot and running into an issue - it doesn't render any calendar events for me. I think it's because some events on my iCal calendar have time zone information associated with them.
Any ideas?
$ ./run_calendar.sh INFO:app:2022-09-26 00:10:13.529526 INFO:app:Retrieving calendar infos CRITICAL:app:can't compare offset-naive and offset-aware datetimes INFO:app:Exporting finial images INFO:app:Init display INFO:app:Writing on display INFO:app:Set display to sleep-mode
I created a test calendar and attempted to induce the same error with combinations of time zones, including some that span midnight. No such luck. Any suggestions for troubleshooting this and figuring it out?
Hi, sorry for the late reply (I'm now back from vacation 😄)
I'll do some testing by myselfe, but it would be great if you could narrow the problem down.
For debugging purposes it's probably helpful to just directly call the get_events()
function inside dataHelper.py
.
Could you print the event_list
from dataHelper.py, Line 30?
This will eliminate the possibility of a problem in the icalevents-lib and give some more insights (without compromising your calendar)
I hope you had a great vacation!
I'm going to be honest, my last programming language was a few Java classes in college 15 years ago. (The SQL I use on a daily basis hardly counts.) I can attempt to muddle through it, but if you've got something I can copy/paste into the command line, we'll probably both spend less time on this.
I figured out how to run the function from the command line (with an arbitrary integer), but I'm utterly failing when trying to get it to print the list. Wherever I stick the print() command, I get syntax errors or messages that it isn't defined.
Is it possible that try errors out and I can't print it because the except executes instead? (Again, sorry for my lack of python knowledge.)
python -c 'from dataHelper import get_events; get_events(10)'
It should work to just add
print(event_list)
after line 31. You need to watch out for a correct indent (as it's pythons way of scoping). The call of the function itself looks good 👍
Added as line 32. (Turns out I'd actually figured this out, but because it resulted in no actionable data, I figured I'd done it wrong.)
try:
event_list = events(WEBDAV_CALENDAR_URL, fix_apple=WEBDAV_IS_APPLE)
event_list.sort(key=sort_by_date)
print(event_list)
start_count = 0
Running it results in this:
kwschnei@pical:~/eInkCalendar $ python -c 'from dataHelper import get_events; get_events(10)'
can't compare offset-naive and offset-aware datetimes
Ok, could you please re-try it with the print in line 31?
try:
event_list = events(WEBDAV_CALENDAR_URL, fix_apple=WEBDAV_IS_APPLE)
print(event_list)
event_list.sort(key=sort_by_date)
try:
event_list = events(WEBDAV_CALENDAR_URL, fix_apple=WEBDAV_IS_APPLE)
print(event_list)
event_list.sort(key=sort_by_date)
start_count = 0
Same result:
kwschnei@pical:~/eInkCalendar $ python -c 'from dataHelper import get_events; get_events(10)'
can't compare offset-naive and offset-aware datetimes
I did a little Googling, so I came up with a question: Does try/except mean that if that try fails at any point, it stops evaluating and immediately dumps what is in the except? If so, is there a way to make the result of event_list available to print in the except area?
Thanks for testing. This means the problem is surprisingly inside the icalevents library : /
You understanding of the try/except is correct, but it can't be used in the way you describe, as the error would be triggered inside the except-block and the hole programm would crash.
That would be this, right? https://pypi.org/project/icalevents/#history
In which case, that's unfortunate because it appears to be dead with no updates for a couple years.
Yes, that's it. The github-page seems alive. I even found the issue: https://github.com/jazzband/icalevents/issues/69
Thanks Louis - I appreciate it. I think I may tinker around with attempting to pull the calendar down with wget and seeing if I can work on a script to find the offending entries and potential remove/fix them if possible as a workaround. It's a two year old bug at this point and that makes me think it's not going to be resolved quickly.
We can either close the issue since it's not your problem, or leave it open and I'll update you if I have success.