# Buggy code
def _ParseDataLocationOption(self, options):
    """Parses the data location option.

    Args:
      options: the command line arguments (instance of argparse.Namespace).
    """
    data_location = getattr(options, "data_location", None)
    if not data_location:
        # Determine if we are running from the source directory.
        # This should get us the path to the "plaso/cli" directory.
        data_location = os.path.dirname(__file__)
        # In order to get to the main path of the egg file we need to traverse
        # two directories up.
        data_location = os.path.dirname(data_location)
        data_location = os.path.dirname(data_location)
        # There are two options: running from source or from an egg file.
        data_location_egg = os.path.join(data_location, "share", "plaso")
        data_location_source = os.path.join(data_location, "data")

        if os.path.exists(data_location_egg):
            data_location = data_location_egg
        elif os.path.exists(data_location_source):
            data_location = data_location_source
        else:
            # Otherwise determine if there is shared plaso data location.
            data_location = os.path.join(sys.prefix, "share", "plaso")

            if not os.path.exists(data_location):
                data_location = None

    self._data_location = data_location


# Traceback (AttributeError)
PYTHONPATH=. ./tools/psort.py --analysis list

******************************* Analysis Plugins *******************************
Traceback (most recent call last):
File "./tools/psort.py", line 604, in <module>
if not Main():
File "./tools/psort.py", line 581, in Main
tool.ListAnalysisPlugins()
File "./tools/psort.py", line 297, in ListAnalysisPlugins
analysis_plugins = self._front_end.GetAnalysisPlugins()
File "/home/onager/code/plaso/plaso/frontend/psort.py", line 96, in GetAnalysisPlugins
return analysis_manager.AnalysisPluginManager.ListAllPluginNames()
File "/home/onager/code/plaso/plaso/analysis/manager.py", line 55, in ListAllPluginNames
for cls_obj in interface.AnalysisPlugin.classes.itervalues():
AttributeError: type object 'AnalysisPlugin' has no attribute 'classes'

# Fixed code
def _ParseDataLocationOption(self, options):
    """Parses the data location option.

    Args:
      options: the command line arguments (instance of argparse.Namespace).
    """
    data_location = getattr(options, "data_location", None)
    if not data_location:
        # Determine if we are running from the source directory.
        # This should get us the path to the "plaso/cli" directory.
        data_location = os.path.dirname(__file__)
        # In order to get to the main path of the egg file we need to traverse
        # two directories up.
        data_location = os.path.dirname(data_location)
        data_location = os.path.dirname(data_location)
        # There are two options: running from source or from an egg file.
        data_location_egg = os.path.join(data_location, "share", "plaso")
        data_location_source = os.path.join(data_location, "data")

        if os.path.exists(data_location_egg):
            data_location = data_location_egg
        elif os.path.exists(data_location_source):
            data_location = data_location_source
        else:
            # Otherwise determine if there is shared plaso data location.
            data_location = os.path.join(sys.prefix, "share", "plaso")

            if not os.path.exists(data_location):
                data_location = None

    logging.info(
        "Data files will be loaded from {0:s} by default.".format(data_location)
    )
    self._data_location = data_location