Skip to content

khal agenda --days=N <date> fails in khal 0.3.1 #151

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

Closed
matthiasbeyer opened this issue Jan 31, 2015 · 19 comments
Closed

khal agenda --days=N <date> fails in khal 0.3.1 #151

matthiasbeyer opened this issue Jan 31, 2015 · 19 comments

Comments

@matthiasbeyer
Copy link

So, this time I know everything on my side is allright:

$ khal agenda --days=20 05.02.2015
Traceback (most recent call last):
  File "/home/m/.local/bin/khal", line 9, in <module>
    load_entry_point('khal==0.3.1', 'console_scripts', 'khal')()
  File "/home/m/.local/lib/python2.7/site-packages/khal/cli.py", line 137, in main_khal
    events=events)
  File "/home/m/.local/lib/python2.7/site-packages/khal/controllers.py", line 141, in __init__
    **kwargs)
  File "/home/m/.local/lib/python2.7/site-packages/khal/controllers.py", line 105, in get_agenda
    desc = textwrap.wrap(event.compact(day), width)
  File "/home/m/.local/lib/python2.7/site-packages/khal/khalendar/event.py", line 209, in compact
    compact = self._compact_allday(day)
  File "/home/m/.local/lib/python2.7/site-packages/khal/khalendar/event.py", line 220, in _compact_allday
    raise ValueError('please supply a `day` this event is scheduled on')
ValueError: please supply a `day` this event is scheduled on
@untitaker
Copy link
Member

It works with the git version though.

@untitaker
Copy link
Member

And yeah, it's been a while since the last release, but big things are planned for 0.4, see #147.

@matthiasbeyer
Copy link
Author

I'm not a python guy, so I don't even understand what the error wants to tell me, ... I guess I will have problems installing it from git,... won't I?

But yeah, looks good for 0.4! I'm looking forward to it!

@untitaker
Copy link
Member

If you installed khal with pip, you can use the git version with:

pip install --force-reinstall git+https://github.com/geier/khal.git

@matthiasbeyer
Copy link
Author

$ khal agenda --days=20 01.02.2015
warning: unknown key or subsection "debug" in section "[default]"
Traceback (most recent call last):
  File "/home/m/.local/bin/khal", line 9, in <module>
    load_entry_point('khal===0.4.0.dev-146-g459751d', 'console_scripts', 'khal')()
  File "/usr/lib/python2.7/site-packages/click/core.py", line 610, in __call__
    return self.main(*args, **kwargs)
  File "/usr/lib/python2.7/site-packages/click/core.py", line 590, in main
    rv = self.invoke(ctx)
  File "/usr/lib/python2.7/site-packages/click/core.py", line 936, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/lib/python2.7/site-packages/click/core.py", line 782, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/lib/python2.7/site-packages/click/core.py", line 416, in invoke
    return callback(*args, **kwargs)
  File "/home/m/.local/lib/python2.7/site-packages/khal/cli.py", line 197, in agenda
    events=events,
  File "/home/m/.local/lib/python2.7/site-packages/khal/controllers.py", line 147, in __init__
    show_all_days=show_all_days, **kwargs)
  File "/home/m/.local/lib/python2.7/site-packages/khal/controllers.py", line 110, in get_agenda
    desc = textwrap.wrap(event.compact(day), width)
  File "/home/m/.local/lib/python2.7/site-packages/khal/khalendar/event.py", line 281, in compact
    compact = self._compact_allday(day)
  File "/home/m/.local/lib/python2.7/site-packages/khal/khalendar/event.py", line 294, in _compact_allday
    'please supply a `day` this event is scheduled on')
ValueError: please supply a `day` this event is scheduled on
$ khal --version
khal, version 0.4.0.dev-146-g459751d

@untitaker
Copy link
Member

Hmm, what is your value for longdateformat?

@matthiasbeyer
Copy link
Author

timeformat = %H:%M                                                               
dateformat = %d.%m.                                                              
longdateformat = %d.%m.%Y                                                        
datetimeformat =  %d.%m. %H:%M                                                   
longdatetimeformat = %d.%m.%Y %H:%M 

@untitaker
Copy link
Member

Could you try pip install --force-reinstall git+https://github.com/geier/khal.git again? It should show better error messages now.

@matthiasbeyer
Copy link
Author

$ khal agenda --days=20 01.02.2015
Traceback (most recent call last):
  File "/home/m/.local/bin/khal", line 9, in <module>
    load_entry_point('khal===0.4.0.dev-147-g0760694', 'console_scripts', 'khal')()
  File "/usr/lib/python2.7/site-packages/pkg_resources/__init__.py", line 519, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/usr/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2630, in load_entry_point
    return ep.load()
  File "/usr/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2310, in load
    return self.resolve()
  File "/usr/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2316, in resolve
    module = __import__(self.module_name, fromlist=['__name__'], level=0)
  File "/home/m/.local/lib/python2.7/site-packages/khal/cli.py", line 33, in <module>
    from khal import controllers
  File "/home/m/.local/lib/python2.7/site-packages/khal/controllers.py", line 111
    for event in itertools.chain(all_day_events, events)
                                                       ^
SyntaxError: invalid syntax

@untitaker
Copy link
Member

Argh, sorry, try again?

@matthiasbeyer
Copy link
Author

$ khal agenda --days=20 01.02.2015
warning: unknown key or subsection "debug" in section "[default]"
Traceback (most recent call last):
  File "/home/m/.local/bin/khal", line 9, in <module>
    load_entry_point('khal===0.4.0.dev-148-g9d4a514', 'console_scripts', 'khal')()
  File "/usr/lib/python2.7/site-packages/click/core.py", line 610, in __call__
    return self.main(*args, **kwargs)
  File "/usr/lib/python2.7/site-packages/click/core.py", line 590, in main
    rv = self.invoke(ctx)
  File "/usr/lib/python2.7/site-packages/click/core.py", line 936, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/lib/python2.7/site-packages/click/core.py", line 782, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/lib/python2.7/site-packages/click/core.py", line 416, in invoke
    return callback(*args, **kwargs)
  File "/home/m/.local/lib/python2.7/site-packages/khal/cli.py", line 197, in agenda
    events=events,
  File "/home/m/.local/lib/python2.7/site-packages/khal/controllers.py", line 143, in __init__
    show_all_days=show_all_days, **kwargs)
  File "/home/m/.local/lib/python2.7/site-packages/khal/controllers.py", line 112, in get_agenda
    desc = textwrap.wrap(event.compact(day), width)
  File "/home/m/.local/lib/python2.7/site-packages/khal/khalendar/event.py", line 287, in compact
    '"{self.href}": {e}'.format(self, str(e)))
KeyError: 'self'

Unfortunately, I'm off now. Hope this gets fixed... but the current method of try-and-error is not really productive. Maybe you should setup everything and try it (I can provide my configuration, if you want), so we can speed up things a bit.

@untitaker
Copy link
Member

I rather think a particular event in your calendars causes the trouble, and the added error message should make it clear which one it is. I am unable to trigger the error myself in any way, which is why I have to resort to trial-and-error.

@untitaker
Copy link
Member

If you get back on this, I just pushed another commit fixing the latest error.

@matthiasbeyer
Copy link
Author

$ khal agenda --days=20 01.02.2015                                                                                                                                                                     │ <<~ [0] [17:57]
warning: unknown key or subsection "debug" in section "[default]"
Traceback (most recent call last):
  File "/home/m/.local/bin/khal", line 9, in <module>
    load_entry_point('khal===0.4.0.dev-149-gce070ec', 'console_scripts', 'khal')()
  File "/usr/lib/python2.7/site-packages/click/core.py", line 610, in __call__
    return self.main(*args, **kwargs)
  File "/usr/lib/python2.7/site-packages/click/core.py", line 590, in main
    rv = self.invoke(ctx)
  File "/usr/lib/python2.7/site-packages/click/core.py", line 936, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/lib/python2.7/site-packages/click/core.py", line 782, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/lib/python2.7/site-packages/click/core.py", line 416, in invoke
    return callback(*args, **kwargs)
  File "/home/m/.local/lib/python2.7/site-packages/khal/cli.py", line 197, in agenda
    events=events,
  File "/home/m/.local/lib/python2.7/site-packages/khal/controllers.py", line 143, in __init__
    show_all_days=show_all_days, **kwargs)
  File "/home/m/.local/lib/python2.7/site-packages/khal/controllers.py", line 112, in get_agenda
    desc = textwrap.wrap(event.compact(day), width)
  File "/home/m/.local/lib/python2.7/site-packages/khal/khalendar/event.py", line 287, in compact
    .format(self.href, str(e)))
RuntimeError: Something went wrong while displaying "[email protected]": please supply a `day` this event is scheduled on

The mentioned event (which I can post without privacy concerns 😄 ) is:

BEGIN:VCALENDAR
VERSION:2.0
PRODID:ownCloud Calendar 0.6.4
BEGIN:VEVENT
UID:rem2ics.54ccca77.7f39.3@localhost
SUMMARY:Valentine's
DTSTART:20150214
DTEND;VALUE=DATE:20150214
DTSTAMP:20150131Z122839Z
COMMENT: generated by rem2ics 0.93\n http://mark.atwood.name/code/rem2ics\n
  data[3]=|2015/02/14 * * * * Valentine's|
END:VEVENT
END:VCALENDAR

looks like the line DTEND;VALUE=DATE:20150214 is the fail, as it looks malformed. What's not so funny: That's an export from ownCloud, as you can see.


Edit: Maybe you should add something which skips entries which fail to get parsed and prints a warning for each (including filepath, maybe).

@untitaker
Copy link
Member

Edit: Maybe you should add something which skips entries which fail to get parsed and prints a warning for each (including filepath, maybe).

It's supposed to work that way. This seems to be some sort of error that couldn't be catched at parse time.

In this case, I think all-day events are supposed to have a DTEND that is ending on the next day. Is this thing displaying correctly in ownCloud?

@matthiasbeyer
Copy link
Author

Hiho.

Yes, as far as I can tell, everything shows up fine in ownCloud!

@untitaker
Copy link
Member

I can reproduce this with any event where DTSTART == DTEND.

@geier I think khal used to have a workaround for situations like this?

@matthiasbeyer
Copy link
Author

Just re-checked the ownCloud entries. They were malformed. The end date was always one day before the start day for all-day events. So this issue is solved for me. Anyhow, the issue is still not solved ... because DTSTART == DTEND shouldn't lead to a crash, should it? 😄

untitaker added a commit that referenced this issue Feb 1, 2015
@untitaker
Copy link
Member

This should be fixed now. Khal now simply assumes the event to last one day if DTEND <= DTSTART

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

No branches or pull requests

3 participants