Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

datetime: offset-naive and offset-aware #2

Open
kwschnei opened this issue Sep 26, 2022 · 12 comments
Open

datetime: offset-naive and offset-aware #2

kwschnei opened this issue Sep 26, 2022 · 12 comments

Comments

@kwschnei
Copy link

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

@kwschnei
Copy link
Author

kwschnei commented Oct 4, 2022

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?

@13Bytes
Copy link
Owner

13Bytes commented Oct 4, 2022

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)

@kwschnei
Copy link
Author

kwschnei commented Oct 4, 2022

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.

@kwschnei
Copy link
Author

kwschnei commented Oct 5, 2022

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)'

@13Bytes
Copy link
Owner

13Bytes commented Oct 6, 2022

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 👍

@kwschnei
Copy link
Author

kwschnei commented Oct 6, 2022

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

@13Bytes
Copy link
Owner

13Bytes commented Oct 6, 2022

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)

@kwschnei
Copy link
Author

kwschnei commented Oct 6, 2022

    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?

@13Bytes
Copy link
Owner

13Bytes commented Oct 6, 2022

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.

@kwschnei
Copy link
Author

kwschnei commented Oct 6, 2022

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.

@13Bytes
Copy link
Owner

13Bytes commented Oct 6, 2022

Yes, that's it.
The github-page seems alive. I even found the issue:
jazzband/icalevents#69

@kwschnei
Copy link
Author

kwschnei commented Oct 6, 2022

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants