pimutils / khal

:calendar: CLI calendar application
https://lostpackets.de/khal/
MIT License
2.62k stars 207 forks source link

problem importing (recurring) event (AttributeError: 'Item' object has no attribute 'calendar') #253

Closed gour closed 9 years ago

gour commented 9 years ago

Hello,

khal & khard (along with vdirsyncer) are the main reasons that I've decided to leave Emas/Gnus/org-moder and settle use vim/tw/etc. which seems to provide better support to sync my contacts/calendars with my Andorid phone using DAVdroid and via my own instance of ownCloud.

I did configure both khal and khard along with vdirsyncer and vdirsyncer was able to import mx contacts and I've seen lot of *.ics files (we are mostly using recurring events), but khal could not display any event.

Then I tried to export & download calendar from OC and then manually import it into khal, but below is the result:

(vdir)gour@atmarama ~/p/vdir> khal import -a gour ~/Downloads/gour-calendar.ics 
03.09.2015: Krema vedske mudrosti <2015-09-03 Thu +2w>
Repeat: FREQ=WEEKLY;INTERVAL=2
Do you want to import this event into `None`? [y/N]: y
Traceback (most recent call last):
  File "/home/gour/prj/vdir/bin/khal", line 11, in <module>
    sys.exit(main_khal())
  File "/home/gour/prj/vdir/local/lib/python2.7/site-packages/click/core.py", line 700, in __call__
    return self.main(*args, **kwargs)
  File "/home/gour/prj/vdir/local/lib/python2.7/site-packages/click/core.py", line 680, in main
    rv = self.invoke(ctx)
  File "/home/gour/prj/vdir/local/lib/python2.7/site-packages/click/core.py", line 1027, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/gour/prj/vdir/local/lib/python2.7/site-packages/click/core.py", line 873, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/gour/prj/vdir/local/lib/python2.7/site-packages/click/core.py", line 508, in invoke
    return callback(*args, **kwargs)
  File "/home/gour/prj/vdir/local/lib/python2.7/site-packages/click/decorators.py", line 16, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/home/gour/prj/vdir/local/lib/python2.7/site-packages/khal/cli.py", line 298, in import_ics
    random_uid=random_uid
  File "/home/gour/prj/vdir/local/lib/python2.7/site-packages/khal/controllers.py", line 216, in import_ics
    import_event(vevent, collection, conf['locale'], batch, random_uid)
  File "/home/gour/prj/vdir/local/lib/python2.7/site-packages/khal/controllers.py", line 257, in import_event
    collection=calendar_name)
  File "/home/gour/prj/vdir/local/lib/python2.7/site-packages/khal/khalendar/khalendar.py", line 330, in new
    self._calnames[event.calendar].new(event)
AttributeError: 'Item' object has no attribute 'calendar'

Here is the *.ics file:

BEGIN:VCALENDAR
VERSION:2.0
PRODID:ownCloud Calendar 0.6.4
X-WR-CALNAME:gour-calendar
BEGIN:VEVENT
DTSTAMP:20150817T150755Z
UID:7fbbdf4c-003d-4bf1-bdeb-ec7b2f79ca5c
DTSTART;VALUE=DATE:20150903
DTEND;VALUE=DATE:20150904
RRULE:FREQ=WEEKLY;INTERVAL=2
SUMMARY:Krema vedske mudrosti <2015-09-03 Thu +2w>
CATEGORIES:gour-calendar
END:VEVENT
END:VCALENDAR

Any hint what might be wrong?

geier commented 9 years ago

Which version of khal and vdirsyncer have you installed?

gour commented 9 years ago

Both are 0.6.0.

geier commented 9 years ago

could you give the current git MASTER a go?

gour commented 9 years ago

It looks the same:

(vdir)gour@atmarama ~/p/v/calendars> khal import -a gour test.ics 
03.09.2015: Krema vedske mudrosti <2015-09-03 Thu +2w>
Repeat: FREQ=WEEKLY;INTERVAL=2
Do you want to import this event into `None`? [y/N]: y
Traceback (most recent call last):
  File "/home/gour/prj/vdir/bin/khal", line 9, in <module>
    load_entry_point('khal==0.6.1.dev82+ng8480d23', 'console_scripts', 'khal')()
  File "/home/gour/prj/vdir/local/lib/python2.7/site-packages/click/core.py", line 700, in __call__
    return self.main(*args, **kwargs)
  File "/home/gour/prj/vdir/local/lib/python2.7/site-packages/click/core.py", line 680, in main
    rv = self.invoke(ctx)
  File "/home/gour/prj/vdir/local/lib/python2.7/site-packages/click/core.py", line 1027, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/gour/prj/vdir/local/lib/python2.7/site-packages/click/core.py", line 873, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/gour/prj/vdir/local/lib/python2.7/site-packages/click/core.py", line 508, in invoke
    return callback(*args, **kwargs)
  File "/home/gour/prj/vdir/local/lib/python2.7/site-packages/click/decorators.py", line 16, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/home/gour/prj/vdir/local/lib/python2.7/site-packages/khal/cli.py", line 299, in import_ics
    random_uid=random_uid
  File "/home/gour/prj/vdir/local/lib/python2.7/site-packages/khal/controllers.py", line 218, in import_ics
    import_event(vevent, collection, conf['locale'], batch, random_uid)
  File "/home/gour/prj/vdir/local/lib/python2.7/site-packages/khal/controllers.py", line 259, in import_event
    collection=calendar_name)
  File "/home/gour/prj/vdir/local/lib/python2.7/site-packages/khal/khalendar/khalendar.py", line 330, in new
    self._calnames[event.calendar].new(event)
AttributeError: 'Item' object has no attribute 'calendar'
geier commented 9 years ago

could you check (and reopen) if this isn't fixed?

gour commented 9 years ago

could you check (and reopen) if this isn't fixed?

Now it works. :-) Thanks a lot!!