# Buggy code
def _FormatDate(self, event_object):
    """Formats the date.

    Args:
      event_object: the event object (instance of EventObject).

     Returns:
       A string containing the value for the date field.
    """
    try:
        date_use = timelib.Timestamp.CopyToDatetime(
            event_object.timestamp, self._output_mediator.timezone, raise_error=True
        )
    except OverflowError as exception:
        logging.error(
            (
                "Unable to copy {0:d} into a human readable timestamp with error: "
                "{1:s}. Event {2!d}:{3!d} triggered the exception."
            ).format(
                event_object.timestamp,
                exception,
                getattr(event_object, "store_number", "N/A"),
                getattr(event_object, "store_index", "N/A"),
            )
        )
        return "0000-00-00"
    return "{0:04d}-{1:02d}-{2:02d}".format(date_use.year, date_use.month, date_use.day)


# Traceback (ValueError)
» PYTHONPATH=. ./tools/psort.py --output_format=dynamic /tmp/test.plaso
[INFO] Data files will be loaded from /home/onager/code/plaso/data by default.
datetime,timestamp_desc,source,source_long,message,parser,display_name,tag,store_number,store_index
Traceback (most recent call last):
File "./tools/psort.py", line 676, in <module>
if not Main():
File "./tools/psort.py", line 671, in Main
tool.ProcessStorage()
File "./tools/psort.py", line 623, in ProcessStorage
self._ProcessStorage()
File "./tools/psort.py", line 252, in _ProcessStorage
time_slice=time_slice, use_time_slicer=self._use_time_slicer)
File "/home/onager/code/plaso/plaso/frontend/psort.py", line 403, in ProcessStorage
analysis_queues=event_queue_producers)
File "/home/onager/code/plaso/plaso/frontend/psort.py", line 556, in ProcessEventsFromStorage
event_object = storage_file.GetSortedEntry()
File "/home/onager/code/plaso/plaso/lib/storage.py", line 1071, in GetSortedEntry
event_object = self.GetEventObject(store_number)
File "/home/onager/code/plaso/plaso/lib/storage.py", line 1131, in GetEventObject
event_object_data)
File "/home/onager/code/plaso/plaso/serializer/json_serializer.py", line 799, in ReadSerialized
return json_decoder.decode(json_string)
File "/usr/lib/python2.7/json/decoder.py", line 366, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/lib/python2.7/json/decoder.py", line 382, in raw_decode
obj, end = self.scan_once(s, idx)
File "/home/onager/code/plaso/plaso/serializer/json_serializer.py", line 249, in _ConvertDictToObject
return self._ConvertDictToPathSpec(json_dict)
File "/home/onager/code/plaso/plaso/serializer/json_serializer.py", line 211, in _ConvertDictToPathSpec
type_indicator, **json_dict)
File "/usr/lib/python2.7/dist-packages/dfvfs/path/factory.py", line 107, in NewPathSpec
return path_spec_type(**kwargs)
File "/usr/lib/python2.7/dist-packages/dfvfs/path/os_path_spec.py", line 42, in __init__
super(OSPathSpec, self).__init__(location=location, parent=parent, **kwargs)
File "/usr/lib/python2.7/dist-packages/dfvfs/path/location_path_spec.py", line 26, in __init__
super(LocationPathSpec, self).__init__(parent=parent, **kwargs)
File "/usr/lib/python2.7/dist-packages/dfvfs/path/path_spec.py", line 25, in __init__
raise ValueError(u'Unused keyword arguments.')
ValueError: Unused keyword arguments.


» ./utils/check_dependencies.py
<snip>
[OK]       dfvfs version: 20151008
<snip>

# Fixed code
def _FormatDate(self, event_object):
    """Formats the date.

    Args:
      event_object: the event object (instance of EventObject).

     Returns:
       A string containing the value for the date field.
    """
    try:
        date_use = timelib.Timestamp.CopyToDatetime(
            event_object.timestamp, self._output_mediator.timezone, raise_error=True
        )
    except OverflowError as exception:
        logging.error(
            (
                "Unable to copy {0:d} into a human readable timestamp with error: "
                "{1:s}. Event {2!s}:{3!s} triggered the exception."
            ).format(
                event_object.timestamp,
                exception,
                getattr(event_object, "store_number", "N/A"),
                getattr(event_object, "store_index", "N/A"),
            )
        )
        return "0000-00-00"
    return "{0:04d}-{1:02d}-{2:02d}".format(date_use.year, date_use.month, date_use.day)