I am trying to use the day field of a datetime property as a filter when selecting events from an iCal calendar.
The following doesn't seem to work (to select all events for the current date):
cal = app("iCal").calendars["myCalender"].get()
cDate = datetime.now()
cEvents = cal.events[its.start_date.day==cDate.day].get()
I get the result: AttributeError: Unknown property, element or command: 'day'
However, this works (for printing the days of any events)...
cal = app("iCal").calendars["myCalender"].get()
for cEvent in cal.events.get():
print cEvent.start_date.get().day
This line
checks
its.start_date.day==cDate.day
and returnsFalse
orTrue
. As an index, this translates into0
and1
and takes one of the first two elements in thecal.events
list. Is this what you want?