# Buggy code
def ParseOptions(self, options):
    """Parses the options.

    Args:
      options: the command line arguments (instance of argparse.Namespace).

    Raises:
      BadConfigOption: if the options are invalid.
    """
    if getattr(options, "show_info", False):
        self.run_mode = self.RUN_MODE_LIST_PLUGINS
        return

    registry_file = getattr(options, "registry_file", None)
    image = getattr(options, "image", None)
    source_path = None
    if image:
        # TODO: refactor, there should be no need for separate code paths.
        super(PregTool, self).ParseOptions(options)
        source_path = image
        self._front_end.SetSingleFile(False)
    else:
        self._ParseInformationalOptions(options)
        source_path = registry_file
        self._front_end.SetSingleFile(True)

    if source_path is None:
        raise errors.BadConfigOption("No source path set.")

    self._front_end.SetSourcePath(source_path)
    self._source_path = os.path.abspath(source_path)

    if not image and not registry_file:
        raise errors.BadConfigOption("Not enough parameters to proceed.")

    if registry_file:
        if not image and not os.path.isfile(registry_file):
            raise errors.BadConfigOption(
                "Registry file: {0:s} does not exist.".format(registry_file)
            )

    self._key_path = getattr(options, "key", None)
    self._parse_restore_points = getattr(options, "restore_points", False)

    self._quiet = getattr(options, "quiet", False)

    self._verbose_output = getattr(options, "verbose", False)

    if image:
        file_to_check = image
    else:
        file_to_check = registry_file

    is_file, reason = self._PathExists(file_to_check)
    if not is_file:
        raise errors.BadConfigOption(
            "Unable to read the input file with error: {0:s}".format(reason)
        )

    self.plugin_names = getattr(options, "plugin_names", "")

    self._front_end.SetKnowledgeBase(self._knowledge_base_object)

    if getattr(options, "console", False):
        self.run_mode = self.RUN_MODE_CONSOLE
    elif getattr(options, "key", "") and registry_file:
        self.run_mode = self.RUN_MODE_REG_KEY
    elif self.plugin_names:
        self.run_mode = self.RUN_MODE_REG_PLUGIN
    elif registry_file:
        self.run_mode = self.RUN_MODE_REG_FILE
    else:
        raise errors.BadConfigOption(
            "Incorrect usage. You'll need to define the path of either "
            "a storage media image or a Windows Registry file."
        )

    self.registry_file = registry_file

    scan_context = self.ScanSource()
    self.source_type = scan_context.source_type
    self._front_end.SetSourcePathSpecs(self._source_path_specs)


# Traceback (AttributeError)
Traceback (most recent call last):
File "/usr/local/bin/preg.py", line 5, in <module>
pkg_resources.run_script('plaso==1.3.0-20150715', u'preg.py')
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 492, in run_script
self.require(requires)[0].run_script(script_name, ns)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 1350, in run_script
execfile(script_filename, namespace, namespace)
File "/Library/Python/2.7/site-packages/plaso-1.3.0_20150715-py2.7.egg/EGG-INFO/scripts/preg.py", line 1711, in <module>
if not Main():
File "/Library/Python/2.7/site-packages/plaso-1.3.0_20150715-py2.7.egg/EGG-INFO/scripts/preg.py", line 1700, in Main
tool.RunModeRegistryPlugin()
File "/Library/Python/2.7/site-packages/plaso-1.3.0_20150715-py2.7.egg/EGG-INFO/scripts/preg.py", line 865, in RunModeRegistryPlugin
plugin_list = self.plugin_names.split(u',')
AttributeError: 'list' object has no attribute 'split'

# Fixed code
def ParseOptions(self, options):
    """Parses the options.

    Args:
      options: the command line arguments (instance of argparse.Namespace).

    Raises:
      BadConfigOption: if the options are invalid.
    """
    if getattr(options, "show_info", False):
        self.run_mode = self.RUN_MODE_LIST_PLUGINS
        return

    registry_file = getattr(options, "registry_file", None)
    image = getattr(options, "image", None)
    source_path = None
    if image:
        # TODO: refactor, there should be no need for separate code paths.
        super(PregTool, self).ParseOptions(options)
        source_path = image
        self._front_end.SetSingleFile(False)
    else:
        self._ParseInformationalOptions(options)
        source_path = registry_file
        self._front_end.SetSingleFile(True)

    if source_path is None:
        raise errors.BadConfigOption("No source path set.")

    self._front_end.SetSourcePath(source_path)
    self._source_path = os.path.abspath(source_path)

    if not image and not registry_file:
        raise errors.BadConfigOption("Not enough parameters to proceed.")

    if registry_file:
        if not image and not os.path.isfile(registry_file):
            raise errors.BadConfigOption(
                "Registry file: {0:s} does not exist.".format(registry_file)
            )

    self._key_path = getattr(options, "key", None)
    self._parse_restore_points = getattr(options, "restore_points", False)

    self._quiet = getattr(options, "quiet", False)

    self._verbose_output = getattr(options, "verbose", False)

    if image:
        file_to_check = image
    else:
        file_to_check = registry_file

    is_file, reason = self._PathExists(file_to_check)
    if not is_file:
        raise errors.BadConfigOption(
            "Unable to read the input file with error: {0:s}".format(reason)
        )

    self.plugin_names = getattr(options, "plugin_names", [])

    self._front_end.SetKnowledgeBase(self._knowledge_base_object)

    if getattr(options, "console", False):
        self.run_mode = self.RUN_MODE_CONSOLE
    elif getattr(options, "key", "") and registry_file:
        self.run_mode = self.RUN_MODE_REG_KEY
    elif self.plugin_names:
        self.run_mode = self.RUN_MODE_REG_PLUGIN
    elif registry_file:
        self.run_mode = self.RUN_MODE_REG_FILE
    else:
        raise errors.BadConfigOption(
            "Incorrect usage. You'll need to define the path of either "
            "a storage media image or a Windows Registry file."
        )

    self.registry_file = registry_file

    scan_context = self.ScanSource()
    self.source_type = scan_context.source_type
    self._front_end.SetSourcePathSpecs(self._source_path_specs)