We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
An unexpected error has occurred.
An unexpected error has occurred.
Please consider posting the following information to the
conda GitHub issue tracker at:

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

Current conda install:

               platform : win-64
          conda version : 4.3.21
       conda is private : False
      conda-env version : 4.3.21
    conda-build version : not installed
         python version : 3.6.1.final.0
       requests version : 2.14.2
       root environment : C:\ProgramData\Anaconda3  (read only)
    default environment : C:\ProgramData\Anaconda3
       envs directories : C:\Users\eric\AppData\Local\conda\conda\envs
                          C:\ProgramData\Anaconda3\envs
                          C:\Users\eric\.conda\envs
          package cache : C:\ProgramData\Anaconda3\pkgs
                          C:\Users\eric\AppData\Local\conda\conda\pkgs
           channel URLs : https://conda.anaconda.org/anaconda-fusion/win-64
                          https://conda.anaconda.org/anaconda-fusion/noarch
                          https://repo.continuum.io/pkgs/free/win-64
                          https://repo.continuum.io/pkgs/free/noarch
                          https://repo.continuum.io/pkgs/r/win-64
                          https://repo.continuum.io/pkgs/r/noarch
                          https://repo.continuum.io/pkgs/pro/win-64
                          https://repo.continuum.io/pkgs/pro/noarch
                          https://repo.continuum.io/pkgs/msys2/win-64
                          https://repo.continuum.io/pkgs/msys2/noarch
            config file : C:\Users\eric\.condarc
             netrc file : None
           offline mode : False
             user-agent : conda/4.3.21 requests/2.14.2 CPython/3.6.1 Windows/10 Windows/10.0.10240
          administrator : False

`$ C:\ProgramData\Anaconda3\Scripts\conda-script.py ..checkenv cmd.exe C:\ProgramData\Anaconda3`




    Traceback (most recent call last):
      File "C:\ProgramData\Anaconda3\lib\site-packages\conda\cli\main.py", line 167, in main
        import conda.cli.activate as activate
      File "C:\ProgramData\Anaconda3\lib\site-packages\conda\cli\activate.py", line 12, in <module>
        from ..utils import shells
      File "C:\ProgramData\Anaconda3\lib\site-packages\conda\utils.py", line 13, in <module>
        from .gateways.disk.read import compute_md5sum
      File "C:\ProgramData\Anaconda3\lib\site-packages\conda\gateways\disk\read.py", line 22, in <module>
        from ...models.channel import Channel
      File "C:\ProgramData\Anaconda3\lib\site-packages\conda\models\channel.py", line 9, in <module>
        from ..base.context import context
      File "C:\ProgramData\Anaconda3\lib\site-packages\conda\base\context.py", line 18, in <module>
        from .._vendor.auxlib.path import expand
      File "C:\ProgramData\Anaconda3\lib\site-packages\conda\_vendor\auxlib\path.py", line 8, in <module>
        import pkg_resources
      File "<frozen importlib._bootstrap>", line 961, in _find_and_load
      File "<frozen importlib._bootstrap>", line 950, in _find_and_load_unlocked
      File "<frozen importlib._bootstrap>", line 646, in _load_unlocked
      File "<frozen importlib._bootstrap>", line 616, in _load_backward_compatible
      File "C:\ProgramData\Anaconda3\lib\site-packages\setuptools-27.2.0-py3.6.egg\pkg_resources\__init__.py", line 2985, in <module>
        @_call_aside
      File "C:\ProgramData\Anaconda3\lib\site-packages\setuptools-27.2.0-py3.6.egg\pkg_resources\__init__.py", line 2971, in _call_aside
        f(*args, **kwargs)
      File "C:\ProgramData\Anaconda3\lib\site-packages\setuptools-27.2.0-py3.6.egg\pkg_resources\__init__.py", line 3013, in _initialize_master_working_set
        dist.activate(replace=False)
      File "C:\ProgramData\Anaconda3\lib\site-packages\setuptools-27.2.0-py3.6.egg\pkg_resources\__init__.py", line 2544, in activate
        declare_namespace(pkg)
      File "C:\ProgramData\Anaconda3\lib\site-packages\setuptools-27.2.0-py3.6.egg\pkg_resources\__init__.py", line 2118, in declare_namespace
        _handle_ns(packageName, path_item)
      File "C:\ProgramData\Anaconda3\lib\site-packages\setuptools-27.2.0-py3.6.egg\pkg_resources\__init__.py", line 2058, in _handle_ns
        _rebuild_mod_path(path, packageName, module)
      File "C:\ProgramData\Anaconda3\lib\site-packages\setuptools-27.2.0-py3.6.egg\pkg_resources\__init__.py", line 2087, in _rebuild_mod_path
        orig_path.sort(key=position_in_sys_path)
    AttributeError: '_NamespacePath' object has no attribute 'sort'


C:\Users\eric>

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `conda/_vendor/auxlib/path.py`
Content:
```
1 # -*- coding: utf-8 -*-
2 from __future__ import print_function, division, absolute_import
3 from distutils.sysconfig import get_python_lib
4 from logging import getLogger
5 from os import chdir, getcwd
6 from os.path import abspath, dirname, exists, expanduser, expandvars, isdir, isfile, join, sep
7 try:
8     import pkg_resources
9 except ImportError:
10     pkg_resources = None
11 import sys
12 
13 log = getLogger(__name__)
14 
15 
16 ROOT_PATH = abspath(sep)
17 
18 
19 def site_packages_paths():
20     if hasattr(sys, 'real_prefix'):
21         # in a virtualenv
22         log.debug('searching virtualenv')
23         return tuple(p for p in sys.path if p.endswith('site-packages'))
24     else:
25         # not in a virtualenv
26         log.debug('searching outside virtualenv')  # pragma: no cover
27         return tuple(get_python_lib(), )  # pragma: no cover
28 
29 
30 class PackageFile(object):
31 
32     def __init__(self, file_path, package_name):
33         self.file_path = file_path
34         self.package_name = package_name
35 
36     def __enter__(self):
37         self.file_handle = open_package_file(self.file_path, self.package_name)
38         return self.file_handle
39 
40     def __exit__(self, *args):
41         self.file_handle.close()
42 
43 
44 class ChangePath(object):
45 
46     def __init__(self, path):
47         self.dirpath = dirname(path) if isfile(path) else path
48         if not isdir(self.dirpath):
49             raise IOError('File or directory not found: {0}'.format(path))
50 
51     def __enter__(self):
52         self.cwd = getcwd()
53         chdir(self.dirpath)
54         return self
55 
56     def __exit__(self, *args):
57         chdir(self.cwd)
58 
59 
60 def open_package_file(file_path, package_name):
61     file_path = expand(file_path)
62 
63     # look for file at relative path
64     if exists(file_path):
65         log.info("found real file {0}".format(file_path))
66         return open(file_path)
67 
68     # look for file in package resources
69     if (package_name and pkg_resources is not None and
70             pkg_resources.resource_exists(package_name, file_path)):
71         log.info("found package resource file {0} for package {1}".format(file_path, package_name))
72         return pkg_resources.resource_stream(package_name, file_path)
73 
74     # look for file in site-packages
75     package_path = find_file_in_site_packages(file_path, package_name)
76     if package_path:
77         return open(package_path)  # pragma: no cover
78 
79     msg = "file for module [{0}] cannot be found at path {1}".format(package_name, file_path)
80     log.error(msg)
81     raise IOError(msg)
82 
83 
84 def find_file_in_site_packages(file_path, package_name):
85     package_path = package_name.replace('.', '/')
86     for site_packages_path in site_packages_paths():
87         test_path = join(site_packages_path, package_path, file_path)
88         if exists(test_path):
89             log.info("found site-package file {0} for package {1}".format(file_path, package_name))
90             return test_path
91         else:
92             log.error("No file found at {0}.".format(test_path))
93     return None
94 
95 
96 def expand(path):
97     return abspath(expanduser(expandvars(path)))
98 
99 
100 def absdirname(path):
101     return abspath(expanduser(dirname(path)))
102
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/conda/_vendor/auxlib/path.py b/conda/_vendor/auxlib/path.py
--- a/conda/_vendor/auxlib/path.py
+++ b/conda/_vendor/auxlib/path.py
@@ -6,7 +6,7 @@
 from os.path import abspath, dirname, exists, expanduser, expandvars, isdir, isfile, join, sep
 try:
     import pkg_resources
-except ImportError:
+except Exception:
     pkg_resources = None
 import sys

{"golden_diff": "diff --git a/conda/_vendor/auxlib/path.py b/conda/_vendor/auxlib/path.py\n--- a/conda/_vendor/auxlib/path.py\n+++ b/conda/_vendor/auxlib/path.py\n@@ -6,7 +6,7 @@\n from os.path import abspath, dirname, exists, expanduser, expandvars, isdir, isfile, join, sep\n try:\n     import pkg_resources\n-except ImportError:\n+except Exception:\n     pkg_resources = None\n import sys\n", "issue": "An unexpected error has occurred.\nAn unexpected error has occurred.\r\nPlease consider posting the following information to the\r\nconda GitHub issue tracker at:\r\n\r\n    https://github.com/conda/conda/issues\r\n\r\nCurrent conda install:\r\n\r\n               platform : win-64\r\n          conda version : 4.3.21\r\n       conda is private : False\r\n      conda-env version : 4.3.21\r\n    conda-build version : not installed\r\n         python version : 3.6.1.final.0\r\n       requests version : 2.14.2\r\n       root environment : C:\\ProgramData\\Anaconda3  (read only)\r\n    default environment : C:\\ProgramData\\Anaconda3\r\n       envs directories : C:\\Users\\eric\\AppData\\Local\\conda\\conda\\envs\r\n                          C:\\ProgramData\\Anaconda3\\envs\r\n                          C:\\Users\\eric\\.conda\\envs\r\n          package cache : C:\\ProgramData\\Anaconda3\\pkgs\r\n                          C:\\Users\\eric\\AppData\\Local\\conda\\conda\\pkgs\r\n           channel URLs : https://conda.anaconda.org/anaconda-fusion/win-64\r\n                          https://conda.anaconda.org/anaconda-fusion/noarch\r\n                          https://repo.continuum.io/pkgs/free/win-64\r\n                          https://repo.continuum.io/pkgs/free/noarch\r\n                          https://repo.continuum.io/pkgs/r/win-64\r\n                          https://repo.continuum.io/pkgs/r/noarch\r\n                          https://repo.continuum.io/pkgs/pro/win-64\r\n                          https://repo.continuum.io/pkgs/pro/noarch\r\n                          https://repo.continuum.io/pkgs/msys2/win-64\r\n                          https://repo.continuum.io/pkgs/msys2/noarch\r\n            config file : C:\\Users\\eric\\.condarc\r\n             netrc file : None\r\n           offline mode : False\r\n             user-agent : conda/4.3.21 requests/2.14.2 CPython/3.6.1 Windows/10 Windows/10.0.10240\r\n          administrator : False\r\n\r\n`$ C:\\ProgramData\\Anaconda3\\Scripts\\conda-script.py ..checkenv cmd.exe C:\\ProgramData\\Anaconda3`\r\n\r\n\r\n\r\n\r\n    Traceback (most recent call last):\r\n      File \"C:\\ProgramData\\Anaconda3\\lib\\site-packages\\conda\\cli\\main.py\", line 167, in main\r\n        import conda.cli.activate as activate\r\n      File \"C:\\ProgramData\\Anaconda3\\lib\\site-packages\\conda\\cli\\activate.py\", line 12, in <module>\r\n        from ..utils import shells\r\n      File \"C:\\ProgramData\\Anaconda3\\lib\\site-packages\\conda\\utils.py\", line 13, in <module>\r\n        from .gateways.disk.read import compute_md5sum\r\n      File \"C:\\ProgramData\\Anaconda3\\lib\\site-packages\\conda\\gateways\\disk\\read.py\", line 22, in <module>\r\n        from ...models.channel import Channel\r\n      File \"C:\\ProgramData\\Anaconda3\\lib\\site-packages\\conda\\models\\channel.py\", line 9, in <module>\r\n        from ..base.context import context\r\n      File \"C:\\ProgramData\\Anaconda3\\lib\\site-packages\\conda\\base\\context.py\", line 18, in <module>\r\n        from .._vendor.auxlib.path import expand\r\n      File \"C:\\ProgramData\\Anaconda3\\lib\\site-packages\\conda\\_vendor\\auxlib\\path.py\", line 8, in <module>\r\n        import pkg_resources\r\n      File \"<frozen importlib._bootstrap>\", line 961, in _find_and_load\r\n      File \"<frozen importlib._bootstrap>\", line 950, in _find_and_load_unlocked\r\n      File \"<frozen importlib._bootstrap>\", line 646, in _load_unlocked\r\n      File \"<frozen importlib._bootstrap>\", line 616, in _load_backward_compatible\r\n      File \"C:\\ProgramData\\Anaconda3\\lib\\site-packages\\setuptools-27.2.0-py3.6.egg\\pkg_resources\\__init__.py\", line 2985, in <module>\r\n        @_call_aside\r\n      File \"C:\\ProgramData\\Anaconda3\\lib\\site-packages\\setuptools-27.2.0-py3.6.egg\\pkg_resources\\__init__.py\", line 2971, in _call_aside\r\n        f(*args, **kwargs)\r\n      File \"C:\\ProgramData\\Anaconda3\\lib\\site-packages\\setuptools-27.2.0-py3.6.egg\\pkg_resources\\__init__.py\", line 3013, in _initialize_master_working_set\r\n        dist.activate(replace=False)\r\n      File \"C:\\ProgramData\\Anaconda3\\lib\\site-packages\\setuptools-27.2.0-py3.6.egg\\pkg_resources\\__init__.py\", line 2544, in activate\r\n        declare_namespace(pkg)\r\n      File \"C:\\ProgramData\\Anaconda3\\lib\\site-packages\\setuptools-27.2.0-py3.6.egg\\pkg_resources\\__init__.py\", line 2118, in declare_namespace\r\n        _handle_ns(packageName, path_item)\r\n      File \"C:\\ProgramData\\Anaconda3\\lib\\site-packages\\setuptools-27.2.0-py3.6.egg\\pkg_resources\\__init__.py\", line 2058, in _handle_ns\r\n        _rebuild_mod_path(path, packageName, module)\r\n      File \"C:\\ProgramData\\Anaconda3\\lib\\site-packages\\setuptools-27.2.0-py3.6.egg\\pkg_resources\\__init__.py\", line 2087, in _rebuild_mod_path\r\n        orig_path.sort(key=position_in_sys_path)\r\n    AttributeError: '_NamespacePath' object has no attribute 'sort'\r\n\r\n\r\nC:\\Users\\eric>\n", "before_files": [{"content": "# -*- coding: utf-8 -*-\nfrom __future__ import print_function, division, absolute_import\nfrom distutils.sysconfig import get_python_lib\nfrom logging import getLogger\nfrom os import chdir, getcwd\nfrom os.path import abspath, dirname, exists, expanduser, expandvars, isdir, isfile, join, sep\ntry:\n    import pkg_resources\nexcept ImportError:\n    pkg_resources = None\nimport sys\n\nlog = getLogger(__name__)\n\n\nROOT_PATH = abspath(sep)\n\n\ndef site_packages_paths():\n    if hasattr(sys, 'real_prefix'):\n        # in a virtualenv\n        log.debug('searching virtualenv')\n        return tuple(p for p in sys.path if p.endswith('site-packages'))\n    else:\n        # not in a virtualenv\n        log.debug('searching outside virtualenv')  # pragma: no cover\n        return tuple(get_python_lib(), )  # pragma: no cover\n\n\nclass PackageFile(object):\n\n    def __init__(self, file_path, package_name):\n        self.file_path = file_path\n        self.package_name = package_name\n\n    def __enter__(self):\n        self.file_handle = open_package_file(self.file_path, self.package_name)\n        return self.file_handle\n\n    def __exit__(self, *args):\n        self.file_handle.close()\n\n\nclass ChangePath(object):\n\n    def __init__(self, path):\n        self.dirpath = dirname(path) if isfile(path) else path\n        if not isdir(self.dirpath):\n            raise IOError('File or directory not found: {0}'.format(path))\n\n    def __enter__(self):\n        self.cwd = getcwd()\n        chdir(self.dirpath)\n        return self\n\n    def __exit__(self, *args):\n        chdir(self.cwd)\n\n\ndef open_package_file(file_path, package_name):\n    file_path = expand(file_path)\n\n    # look for file at relative path\n    if exists(file_path):\n        log.info(\"found real file {0}\".format(file_path))\n        return open(file_path)\n\n    # look for file in package resources\n    if (package_name and pkg_resources is not None and\n            pkg_resources.resource_exists(package_name, file_path)):\n        log.info(\"found package resource file {0} for package {1}\".format(file_path, package_name))\n        return pkg_resources.resource_stream(package_name, file_path)\n\n    # look for file in site-packages\n    package_path = find_file_in_site_packages(file_path, package_name)\n    if package_path:\n        return open(package_path)  # pragma: no cover\n\n    msg = \"file for module [{0}] cannot be found at path {1}\".format(package_name, file_path)\n    log.error(msg)\n    raise IOError(msg)\n\n\ndef find_file_in_site_packages(file_path, package_name):\n    package_path = package_name.replace('.', '/')\n    for site_packages_path in site_packages_paths():\n        test_path = join(site_packages_path, package_path, file_path)\n        if exists(test_path):\n            log.info(\"found site-package file {0} for package {1}\".format(file_path, package_name))\n            return test_path\n        else:\n            log.error(\"No file found at {0}.\".format(test_path))\n    return None\n\n\ndef expand(path):\n    return abspath(expanduser(expandvars(path)))\n\n\ndef absdirname(path):\n    return abspath(expanduser(dirname(path)))\n", "path": "conda/_vendor/auxlib/path.py"}], "after_files": [{"content": "# -*- coding: utf-8 -*-\nfrom __future__ import print_function, division, absolute_import\nfrom distutils.sysconfig import get_python_lib\nfrom logging import getLogger\nfrom os import chdir, getcwd\nfrom os.path import abspath, dirname, exists, expanduser, expandvars, isdir, isfile, join, sep\ntry:\n    import pkg_resources\nexcept Exception:\n    pkg_resources = None\nimport sys\n\nlog = getLogger(__name__)\n\n\nROOT_PATH = abspath(sep)\n\n\ndef site_packages_paths():\n    if hasattr(sys, 'real_prefix'):\n        # in a virtualenv\n        log.debug('searching virtualenv')\n        return tuple(p for p in sys.path if p.endswith('site-packages'))\n    else:\n        # not in a virtualenv\n        log.debug('searching outside virtualenv')  # pragma: no cover\n        return tuple(get_python_lib(), )  # pragma: no cover\n\n\nclass PackageFile(object):\n\n    def __init__(self, file_path, package_name):\n        self.file_path = file_path\n        self.package_name = package_name\n\n    def __enter__(self):\n        self.file_handle = open_package_file(self.file_path, self.package_name)\n        return self.file_handle\n\n    def __exit__(self, *args):\n        self.file_handle.close()\n\n\nclass ChangePath(object):\n\n    def __init__(self, path):\n        self.dirpath = dirname(path) if isfile(path) else path\n        if not isdir(self.dirpath):\n            raise IOError('File or directory not found: {0}'.format(path))\n\n    def __enter__(self):\n        self.cwd = getcwd()\n        chdir(self.dirpath)\n        return self\n\n    def __exit__(self, *args):\n        chdir(self.cwd)\n\n\ndef open_package_file(file_path, package_name):\n    file_path = expand(file_path)\n\n    # look for file at relative path\n    if exists(file_path):\n        log.info(\"found real file {0}\".format(file_path))\n        return open(file_path)\n\n    # look for file in package resources\n    if (package_name and pkg_resources is not None and\n            pkg_resources.resource_exists(package_name, file_path)):\n        log.info(\"found package resource file {0} for package {1}\".format(file_path, package_name))\n        return pkg_resources.resource_stream(package_name, file_path)\n\n    # look for file in site-packages\n    package_path = find_file_in_site_packages(file_path, package_name)\n    if package_path:\n        return open(package_path)  # pragma: no cover\n\n    msg = \"file for module [{0}] cannot be found at path {1}\".format(package_name, file_path)\n    log.error(msg)\n    raise IOError(msg)\n\n\ndef find_file_in_site_packages(file_path, package_name):\n    package_path = package_name.replace('.', '/')\n    for site_packages_path in site_packages_paths():\n        test_path = join(site_packages_path, package_path, file_path)\n        if exists(test_path):\n            log.info(\"found site-package file {0} for package {1}\".format(file_path, package_name))\n            return test_path\n        else:\n            log.error(\"No file found at {0}.\".format(test_path))\n    return None\n\n\ndef expand(path):\n    return abspath(expanduser(expandvars(path)))\n\n\ndef absdirname(path):\n    return abspath(expanduser(dirname(path)))\n", "path": "conda/_vendor/auxlib/path.py"}]}