Closed szymonpindur closed 2 years ago
Edit: It was a problem with events which have been labelled as "cancelled" in my Google Calendar. A quick solution was to filter the calItems list of dictionaries so that it didn't include the events with status "cancelled".
Hi! Could you share how you edited the code for this to work? I'm facing the same issue
Didn't know how to code in Python but after a few hours, tests and googling I came up with another solution: since the problem is being caused by the key "summary" missing in items in events list, them having the status "cancelled" or not isn't the issue to be addressed.
I've renamed the original events list to eventsunfiltered and created a new events list filtering any list item that doesn't have the word "summary" in it.
##Get the GCal Ids and other Event Info from Google Calendar
eventsunfiltered = []
for el in calendarDictionary.keys(): #get all the events from all calendars of interest
x = service.events().list(calendarId = calendarDictionary[el], maxResults = 2000, timeMin = googleQuery() ).execute()
eventsunfiltered.extend(x['items'])
print(eventsunfiltered)
desiredwords = ['summary']
events = [x for x in eventsunfiltered if any(word in x for word in desiredwords)]
print(events)
Notion feeds GCal perfectly, but when I run Part 4: Bring events (not in Notion already) from GCal to Notion it gives me this error: File "Notion-GCal-2WaySync-Public.py", line 1253, in
calName = [item['summary'] for item in calItems]
File "Notion-GCal-2WaySync-Public.py", line 1253, in
calName = [item['summary'] for item in calItems]
KeyError: 'summary'
I'm kinda a python newbie, so I'd be grateful for any help ;)