{"action":"opened","issue":{"url":"https://api.github.com/repos/pimutils/khal/issues/486","repository_url":"https://api.github.com/repos/pimutils/khal","labels_url":"https://api.github.com/repos/pimutils/khal/issues/486/labels{/name}","comments_url":"https://api.github.com/repos/pimutils/khal/issues/486/comments","events_url":"https://api.github.com/repos/pimutils/khal/issues/486/events","html_url":"https://github.com/pimutils/khal/issues/486","id":173163160,"number":486,"title":"khal at broken in 0.8.2","user":{"login":"milouse","id":349239,"avatar_url":"https://avatars.githubusercontent.com/u/349239?v=3","gravatar_id":"","url":"https://api.github.com/users/milouse","html_url":"https://github.com/milouse","followers_url":"https://api.github.com/users/milouse/followers","following_url":"https://api.github.com/users/milouse/following{/other_user}","gists_url":"https://api.github.com/users/milouse/gists{/gist_id}","starred_url":"https://api.github.com/users/milouse/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/milouse/subscriptions","organizations_url":"https://api.github.com/users/milouse/orgs","repos_url":"https://api.github.com/users/milouse/repos","events_url":"https://api.github.com/users/milouse/events{/privacy}","received_events_url":"https://api.github.com/users/milouse/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2016-08-25T10:04:42Z","updated_at":"2016-08-25T10:04:42Z","closed_at":null,"body":"khal at raise an error when used with a complete datetime\r\n\r\n```\r\n$ khal at \"27/08/2016\"\r\n\r\n(works as expected)\r\n$ khal at \"09:00\"\r\n\r\n(works as expected)\r\n$ khal at\r\n\r\n(works as expected)\r\n$ khal at \"27/08/2016 09:00\"\r\nTraceback (most recent call last):\r\n  File \"/usr/bin/khal\", line 11, in <module>\r\n    load_entry_point('khal==0.8.2', 'console_scripts', 'khal')()\r\n  File \"/usr/lib/python3.5/site-packages/click/core.py\", line 716, in __call__\r\n    return self.main(*args, **kwargs)\r\n  File \"/usr/lib/python3.5/site-packages/click/core.py\", line 696, in main\r\n    rv = self.invoke(ctx)\r\n  File \"/usr/lib/python3.5/site-packages/click/core.py\", line 1060, in invoke\r\n    return _process_result(sub_ctx.command.invoke(sub_ctx))\r\n  File \"/usr/lib/python3.5/site-packages/click/core.py\", line 889, in invoke\r\n    return ctx.invoke(self.callback, **ctx.params)\r\n  File \"/usr/lib/python3.5/site-packages/click/core.py\", line 534, in invoke\r\n    return callback(*args, **kwargs)\r\n  File \"/usr/lib/python3.5/site-packages/click/decorators.py\", line 17, in new_func\r\n    return f(get_current_context(), *args, **kwargs)\r\n  File \"/usr/lib/python3.5/site-packages/khal/cli.py\", line 462, in at\r\n    dtime, _ = aux.guessdatetimefstr(dtime_list, locale)\r\n  File \"/usr/lib/python3.5/site-packages/khal/aux.py\", line 207, in guessdatetimefstr\r\n    dtstart = fun(dtime_list, dtformat)\r\n  File \"/usr/lib/python3.5/site-packages/khal/aux.py\", line 71, in datetimefstr\r\n    dtime_list.pop(0)\r\nIndexError: pop from empty list\r\n```\r\n\r\nI fix this issue by adding the following lines in /usr/lib/python3.5/site-packages/khal/aux.py at line ~71\r\n\r\n```python\r\nif not dtime_list:\r\n    continue\r\n```\r\n\r\nThe same in context (from line 57)\r\n\r\n```python\r\ndef datetimefstr(dtime_list, dtformat):\r\n    \"\"\"\r\n    converts a datetime (as one or several string elements of a list) to\r\n    a datetimeobject\r\n\r\n    removes \"used\" elements of list\r\n\r\n    :returns: a datetime\r\n    :rtype: datetime.datetime\r\n    \"\"\"\r\n    parts = dtformat.count(' ') + 1\r\n    dtstring = ' '.join(dtime_list[0:parts])\r\n    dtstart = datetime.strptime(dtstring, dtformat)\r\n    for _ in range(parts):\r\n        if not dtime_list:\r\n            continue\r\n        dtime_list.pop(0)\r\n    return dtstart\r\n```"}}
{"actor":{"display_login":"milouse"}}