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

Bug: KeyError when The Event has no Summary Field #41

Closed
Zackhardtoname opened this issue Aug 31, 2020 · 14 comments · May be fixed by #48
Closed

Bug: KeyError when The Event has no Summary Field #41

Zackhardtoname opened this issue Aug 31, 2020 · 14 comments · May be fixed by #48
Labels
bug Something isn't working

Comments

@Zackhardtoname
Copy link

➜ Downloads i3-agenda
Traceback (most recent call last):
File "/usr/bin/i3-agenda", line 8, in
sys.exit(main())
File "/usr/lib/python3.8/site-packages/i3_agenda/init.py", line 97, in main
events = getEvents(service, allowed_calendars_ids, args.maxres,
File "/usr/lib/python3.8/site-packages/i3_agenda/init.py", line 147, in getEvents
all.append(Event(event['summary'], is_allday(start_time), unix_time, end_time))
KeyError: 'summary'

Looks like some commit broke it cuz it used to work for me on Manjaro i3. After adding a summary field, it works again.

@rosenpin
Copy link
Owner

Isn't summary just the event name? how do you even create an event without a title?

@rosenpin rosenpin added the bug Something isn't working label Aug 31, 2020
@Zackhardtoname
Copy link
Author

The rectangular area:
image

@rosenpin
Copy link
Owner

rosenpin commented Sep 1, 2020

Are you sure? Can you reproduce it this way? Because I never enter a description and it doesn't crash for me

@Zackhardtoname
Copy link
Author

Somehow I can't reproduce it now, but I am sure that's the problematic field since the error went away as soon as I put in some text there. (Previously, reinstalling did not help.)

@rosenpin
Copy link
Owner

rosenpin commented Sep 1, 2020

I read the logs you sent, seems like the error occurs in this line
https://github.com/rosenpin/i3-agenda/blob/master/i3_agenda/__init__.py#L147

The summary field is the title as far as I know, this is how it works when I use it so there shouldn't be a different in your instance (unless there was a change to the API and you have a newer version than I)

I'll look into the error when I get the time

@snide
Copy link

snide commented Feb 7, 2021

First. Thank you for this wonderful package. I just wanted to report that trying to install this with a fresh install through AUR i get a similar error. Credentials were created and look find. When I run with the -u flag I get.

Traceback (most recent call last):
  File "/bin/i3-agenda", line 33, in <module>
    sys.exit(load_entry_point('i3-agenda==1.4', 'console_scripts', 'i3-agenda')())
  File "/usr/lib/python3.9/site-packages/i3_agenda/__init__.py", line 100, in main
    events = getEvents(service, allowed_calendars_ids, args.maxres,
  File "/usr/lib/python3.9/site-packages/i3_agenda/__init__.py", line 173, in getEvents
    all.append(Event(event['summary'],
KeyError: 'summary'

I can see the .i3agenda folder is created, with the token.pickle. The .cache.txt file ends up being an empty array.

If you have any ideas please let me know. This looks like a fantastic script and I appreciate the time you took to build it.

@indradhanush
Copy link

🐛 Just tried this out and I have the same error as @snide. This looks like a fantastic module. <3

@indradhanush
Copy link

indradhanush commented Feb 18, 2021

I looked into this and with patch in PR #48, the code no longer runs into this error. However I'm not sure if that's a complete fix. At the moment, after running the script just with the -c flag set, I get this output:

%d/%m at 01:45 busy

@rosenpin
Copy link
Owner

Do you literally get "%d/%m"? or the actual day/month?

I think maybe shared events really be the reason for this because I don't really have any shared events and I never ran into such issue

@rosenpin
Copy link
Owner

@snide do you have shared events in your calendar?

Could you try @indradhanush patch?

@indradhanush
Copy link

Do you literally get "%d/%m"? or the actual day/month?

Yes, indeed. I was confused and thought that maybe I am missing some additional configuration? I will try this out without a shared calendar and see if I am seeing a similar behaviour.

@snide
Copy link

snide commented Feb 19, 2021 via email

@indradhanush
Copy link

indradhanush commented Feb 19, 2021

I checked today where the next / current event description was publicly available from the shared calendar and the description along with the timestamp was printed as the output. However, if the event description is not publicly available, I still see the %d/%m in the output.

And on that note, I was also thinking that users may only want to use i3-agenda as what is the next meeting in their calendar that they need to be at instead of seeing a notification for the next meeting from every shared calendar. Would it be possible to maybe optionally exclude all shared calendars? That is if the user wanted, they may set a flag like --exclude-shared=foo,bar,baz and that would only exclude these three calendars from the events list?

Or alternatively, the opposite of the above as --include-shared=foo,bar,baz and it only shows events from these shared calendars while excluding every other shared calendar? And if that flag is not set, i3-agenda skips all events from shared calendars.

What do you think?

Edit: My bad. I was reading the code, and it seems this is already doable with the --ids flag.

@rosenpin
Copy link
Owner

Solved at #88

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants