Zim

Calendar crashes when clicked

Bug #1440288 reported by Paul Chrastina
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Zim
Fix Released
Undecided
Unassigned

Bug Description

This is zim 0.62
Platform: nt
Locale: en_US cp1252
FS encoding: mbcs
Python: (2, 7, 8, 'final', 0)
Gtk: (2, 24, 10)
Pygtk: (2, 24, 0)
Zim revision is:
  branch: 062
  revision: 739 <email address hidden>
  date: 2014-10-10 21:28:06 +0200

======= Traceback =======
  File "zim\actions.pyo", line 55, in func
  File "zim\plugins\calendar.pyo", line 268, in show_calendar
  File "zim\gui\widgets.pyo", line 2841, in unique
  File "zim\plugins\calendar.pyo", line 478, in __init__
  File "zim\plugins\calendar.pyo", line 405, in __init__
  File "zim\plugins\calendar.pyo", line 432, in on_month_changed
  File "zim\plugins\calendar.pyo", line 463, in list_dates_for_month
  File "zim\plugins\calendar.pyo", line 51, in daterange_from_path
ValueError: day is out of range for month

This started happening on 01 April, previously I had no issues.

Revision history for this message
Pl (plprgt) wrote :

Can't say exactly if my situation is the same, but traceback looks similar.
Creating a new day page in calendar in current month with 100 > name > 31 cause plugin crash on next start.
It seems this error occurs while transforming date to datetime.date object (daterange_from_path function in calendar.py), but since such date can't exist this raise ValueError.

The solution could be to wrap datetime.date in try/except and return None if exception occurs (see patch for example) - I don't think it will break something.

======= Traceback =======
....
File ...\zim-0.63\zim\actions.py", line 55, in func
    self.func(instance, *arg, **kwarg)
File ...\zim-0.63\zim\plugins\calendar.py", line 271, in show_calendar
    dialog = CalendarDialog.unique(self, self.plugin, self.window)
File ...\zim-0.63\zim\gui\widgets.py", line 2851, in unique
    dialog = klass(*args, **opts)
File ...\zim-0.63\zim\plugins\calendar.py", line 482, in __init__
    self.calendar_widget = CalendarWidget(model)
File ...\zim-0.63\zim\plugins\calendar.py", line 409, in __init__
    self.on_month_changed(self.calendar)
File ...\zim-0.63\zim\plugins\calendar.py", line 436, in on_month_changed
    for date in self.model.list_dates_for_month(self.calendar.get_date()):
File ...\zim-0.63\zim\plugins\calendar.py", line 467, in list_dates_for_month
    dates = daterange_from_path(path)
File ...\zim-0.63\zim\plugins\calendar.py", line 51, in daterange_from_path
    date = datetime.date(year, month, day)
ValueError: day is out of range for month
=========================

Revision history for this message
Jaap Karssenberg (jaap.karssenberg) wrote :

Fix committed in rev775

Changed in zim:
status: New → Fix Committed
Changed in zim:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.