# Buggy code
def execute(args, parser):
    from ..base.context import context
    from .common import stdout_json

    prefix = context.prefix_w_legacy_search
    regex = args.regex
    if args.full_name:
        regex = r"^%s$" % regex

    if args.revisions:
        from ..history import History

        h = History(prefix)
        if isfile(h.path):
            if not context.json:
                h.print_log()
            else:
                stdout_json(h.object_log())
        else:
            from ..exceptions import CondaFileNotFoundError

            raise CondaFileNotFoundError(h.path)
        return

    if args.explicit:
        print_explicit(prefix, args.md5)
        return

    if args.canonical:
        format = "canonical"
    elif args.export:
        format = "export"
    else:
        format = "human"
    if context.json:
        format = "canonical"

    exitcode = print_packages(
        prefix,
        regex,
        format,
        piplist=args.pip,
        json=context.json,
        show_channel_urls=context.show_channel_urls,
    )
    return exitcode


# Traceback (conda.exceptions.CondaFileNotFoundError)
Traceback (most recent call last):
File "/conda/lib/python3.6/site-packages/conda/core/package_cache.py", line 502, in _execute_action
action.execute()
File "/conda/lib/python3.6/site-packages/conda/core/path_actions.py", line 739, in execute
source_md5sum = compute_md5sum(source_path)
File "/conda/lib/python3.6/site-packages/conda/gateways/disk/read.py", line 59, in compute_md5sum
raise CondaFileNotFoundError(file_full_path)
conda.exceptions.CondaFileNotFoundError: <unprintable CondaFileNotFoundError object>

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/conda/lib/python3.6/site-packages/conda/exceptions.py", line 592, in conda_exception_handler
return_value = func(*args, **kwargs)
File "/conda/lib/python3.6/site-packages/conda/cli/main.py", line 134, in _main
exit_code = args.func(args, p)
File "/conda/lib/python3.6/site-packages/conda/cli/main_install.py", line 80, in execute
install(args, parser, 'install')
File "/conda/lib/python3.6/site-packages/conda/cli/install.py", line 200, in install
explicit(args.packages, prefix, verbose=not context.quiet)
File "/conda/lib/python3.6/site-packages/conda/misc.py", line 90, in explicit
pfe.execute()
File "/conda/lib/python3.6/site-packages/conda/core/package_cache.py", line 491, in execute
self._execute_action(action)
File "/conda/lib/python3.6/site-packages/conda/core/package_cache.py", line 507, in _execute_action
exceptions.append(CondaError(repr(e)))
File "/conda/lib/python3.6/site-packages/conda/__init__.py", line 43, in __repr__
return '%s: %s\n' % (self.__class__.__name__, text_type(self))
File "/conda/lib/python3.6/site-packages/conda/__init__.py", line 48, in __str__
return text_type(self.message % self._kwargs)
TypeError: must be real number, not dict

# Fixed code
def execute(args, parser):
    from ..base.context import context
    from .common import stdout_json

    prefix = context.prefix_w_legacy_search
    regex = args.regex
    if args.full_name:
        regex = r"^%s$" % regex

    if args.revisions:
        from ..history import History

        h = History(prefix)
        if isfile(h.path):
            if not context.json:
                h.print_log()
            else:
                stdout_json(h.object_log())
        else:
            from ..exceptions import FileNotFoundError

            raise FileNotFoundError(h.path)
        return

    if args.explicit:
        print_explicit(prefix, args.md5)
        return

    if args.canonical:
        format = "canonical"
    elif args.export:
        format = "export"
    else:
        format = "human"
    if context.json:
        format = "canonical"

    exitcode = print_packages(
        prefix,
        regex,
        format,
        piplist=args.pip,
        json=context.json,
        show_channel_urls=context.show_channel_urls,
    )
    return exitcode