# Buggy code
def _ProcessDataStreams(self, file_entry):
    """Processes the data streams in a file entry.

    Args:
      file_entry: a file entry (instance of dfvfs.FileEntry).
    """
    produced_main_path_spec = False
    for data_stream in file_entry.data_streams:
        # Make a copy so we don't make the changes on a path specification
        # directly. Otherwise already produced path specifications can be
        # altered in the process.
        path_spec = copy.deepcopy(file_entry.path_spec)
        setattr(path_spec, "data_stream", data_stream.name)
        self.ProduceItem(path_spec)

        if not data_stream.name:
            produced_main_path_spec = True

    if not produced_main_path_spec and (
        not file_entry.IsDirectory() or self._collect_directory_metadata
    ):
        self.ProduceItem(file_entry.path_spec)


# 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 _ProcessDataStreams(self, file_entry):
    """Processes the data streams in a file entry.

    Args:
      file_entry: a file entry (instance of dfvfs.FileEntry).
    """
    produced_main_path_spec = False
    for data_stream in file_entry.data_streams:
        # Make a copy so we don't make the changes on a path specification
        # directly. Otherwise already produced path specifications can be
        # altered in the process.
        path_spec = copy.deepcopy(file_entry.path_spec)
        if data_stream.name:
            setattr(path_spec, "data_stream", data_stream.name)
        self.ProduceItem(path_spec)

        if not data_stream.name:
            produced_main_path_spec = True

    if not produced_main_path_spec and (
        not file_entry.IsDirectory() or self._collect_directory_metadata
    ):
        self.ProduceItem(file_entry.path_spec)