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

    if args.root:
        if context.json:
            stdout_json({"root_prefix": context.root_prefix})
        else:
            print(context.root_prefix)
        return

    if args.packages:
        print_package_info(args.packages)
        return

    if args.unsafe_channels:
        if not context.json:
            print("\n".join(context.channels))
        else:
            print(json.dumps({"channels": context.channels}))
        return 0

    options = "envs", "system", "license"

    if args.all or context.json:
        for option in options:
            setattr(args, option, True)

    info_dict = get_info_dict(args.system)

    if (
        args.all or all(not getattr(args, opt) for opt in options)
    ) and not context.json:
        print_main_info(info_dict)

    if args.envs:
        handle_envs_list(info_dict["envs"], not context.json)

    if args.system:
        if not context.json:
            from .find_commands import find_commands, find_executable

            print("sys.version: %s..." % (sys.version[:40]))
            print("sys.prefix: %s" % sys.prefix)
            print("sys.executable: %s" % sys.executable)
            print("conda location: %s" % info_dict["conda_location"])
            for cmd in sorted(set(find_commands() + ["build"])):
                print("conda-%s: %s" % (cmd, find_executable("conda-" + cmd)))
            print("user site dirs: ", end="")
            site_dirs = get_user_site()
            if site_dirs:
                print(site_dirs[0])
            else:
                print()
            for site_dir in site_dirs[1:]:
                print("                %s" % site_dir)
            print()

            for name, value in sorted(iteritems(info_dict["env_vars"])):
                print("%s: %s" % (name, value))
            print()

    if args.license and not context.json:
        try:
            from _license import show_info

            show_info()
        except ImportError:
            print("""\
WARNING: could not import _license.show_info
# try:
# $ conda install -n root _license""")

    if context.json:
        stdout_json(info_dict)


# Traceback (ImportError)
$ conda -h
An unexpected error has occurred.
Please consider posting the following information to the
conda GitHub issue tracker at:

https://github.com/conda/conda/issues



Traceback (most recent call last):
File "/home/vmrguser/anaconda2/bin/conda", line 6, in <module>
sys.exit(conda.cli.main())
File "/home/vmrguser/anaconda2/lib/python2.7/site-packages/conda/cli/main.py", line 164, in main
return conda_exception_handler(_main, *args)
File "/home/vmrguser/anaconda2/lib/python2.7/site-packages/conda/exceptions.py", line 589, in conda_exception_handler
print_unexpected_error_message(e)
File "/home/vmrguser/anaconda2/lib/python2.7/site-packages/conda/exceptions.py", line 543, in print_unexpected_error_message
info_stdout, info_stderr = get_info()
File "/home/vmrguser/anaconda2/lib/python2.7/site-packages/conda/exceptions.py", line 513, in get_info
args.func(args, p)
File "/home/vmrguser/anaconda2/lib/python2.7/site-packages/conda/cli/main_info.py", line 148, in execute
from conda.api import get_index
File "/home/vmrguser/anaconda2/lib/python2.7/site-packages/conda/api.py", line 1, in <module>
from .core.index import get_index
File "/home/vmrguser/anaconda2/lib/python2.7/site-packages/conda/core/index.py", line 9, in <module>
from .repodata import collect_all_repodata
File "/home/vmrguser/anaconda2/lib/python2.7/site-packages/conda/core/repodata.py", line 21, in <module>
from requests.packages.urllib3.exceptions import InsecureRequestWarning
ImportError: No module named packages.urllib3.exceptions

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

    if args.root:
        if context.json:
            stdout_json({"root_prefix": context.root_prefix})
        else:
            print(context.root_prefix)
        return

    if args.packages:
        print_package_info(args.packages)
        return

    if args.unsafe_channels:
        if not context.json:
            print("\n".join(context.channels))
        else:
            print(json.dumps({"channels": context.channels}))
        return 0

    options = "envs", "system", "license"

    if args.all or context.json:
        for option in options:
            setattr(args, option, True)

    info_dict = get_info_dict(args.system)

    if (
        args.all or all(not getattr(args, opt) for opt in options)
    ) and not context.json:
        print(get_main_info_str(info_dict))

    if args.envs:
        handle_envs_list(info_dict["envs"], not context.json)

    if args.system:
        if not context.json:
            from .find_commands import find_commands, find_executable

            print("sys.version: %s..." % (sys.version[:40]))
            print("sys.prefix: %s" % sys.prefix)
            print("sys.executable: %s" % sys.executable)
            print("conda location: %s" % info_dict["conda_location"])
            for cmd in sorted(set(find_commands() + ["build"])):
                print("conda-%s: %s" % (cmd, find_executable("conda-" + cmd)))
            print("user site dirs: ", end="")
            site_dirs = get_user_site()
            if site_dirs:
                print(site_dirs[0])
            else:
                print()
            for site_dir in site_dirs[1:]:
                print("                %s" % site_dir)
            print()

            for name, value in sorted(iteritems(info_dict["env_vars"])):
                print("%s: %s" % (name, value))
            print()

    if args.license and not context.json:
        try:
            from _license import show_info

            show_info()
        except ImportError:
            print("""\
WARNING: could not import _license.show_info
# try:
# $ conda install -n root _license""")

    if context.json:
        stdout_json(info_dict)