We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Issue running blaze-server in 0.9.0 release
```
$ python --version
Python 3.4.4 :: Continuum Analytics, Inc.

$ python -c 'import blaze; print(blaze.__version__)'
0.9.0

$ blaze-server ./foo.yaml
Traceback (most recent call last):
  File "/Users/ksmith/anaconda/envs/test-blaze-0.9.0/bin/blaze-server", line 6, in <module>
    sys.exit(blaze.server.spider._main())
AttributeError: 'function' object has no attribute '_main'
```

The best I can tell, this issue is related to the `import blaze.server.spider` line, and an ambiguity in this `import`.  There's both a `blaze/server/spider.py` module, and inside `blaze/server/__init__.py` is a `from .spider import spider`, which imports the spider _function_ in the `blaze.server` namespace.

The strange thing is that this particular logic is unchanged since Blaze 0.8.3, and `blaze-server` worked fine then.

In any case, dealiasing the `spider` name in `blaze.server` is a good idea anyway to rule out this issue once and for all.  Fix forthcoming.


--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `blaze/server/spider.py`
Content:
```
1 #!/usr/bin/env python
2 
3 from __future__ import absolute_import
4 
5 import os
6 import sys
7 import argparse
8 
9 import yaml
10 
11 from odo import resource
12 from odo.utils import ignoring
13 
14 from .server import Server, DEFAULT_PORT
15 
16 try:
17     import __builtin__ as builtins
18 except ImportError:
19     import builtins
20 
21 
22 __all__ = 'spider', 'from_yaml'
23 
24 
25 def _spider(resource_path, ignore, followlinks, hidden):
26     resources = {}
27     for filename in (os.path.join(resource_path, x)
28                      for x in os.listdir(resource_path)):
29         basename = os.path.basename(filename)
30         if (basename.startswith(os.curdir) and not hidden or
31                 os.path.islink(filename) and not followlinks):
32             continue
33         if os.path.isdir(filename):
34             new_resources = _spider(filename, ignore=ignore,
35                                     followlinks=followlinks, hidden=hidden)
36             if new_resources:
37                 resources[basename] = new_resources
38         else:
39             with ignoring(*ignore):
40                 resources[basename] = resource(filename)
41     return resources
42 
43 
44 def spider(path, ignore=(ValueError, NotImplementedError), followlinks=True,
45            hidden=False):
46     """Traverse a directory and call ``odo.resource`` on its contentso
47 
48     Parameters
49     ----------
50     path : str
51         Path to a directory of resources to load
52     ignore : tuple of Exception, optional
53         Ignore these exceptions when calling resource
54     followlinks : bool, optional
55         Follow symbolic links
56     hidden : bool, optional
57         Load hidden files
58 
59     Returns
60     -------
61     dict
62         Possibly nested dictionary of containing basenames mapping to resources
63     """
64     return {
65         os.path.basename(path): _spider(path, ignore=ignore,
66                                         followlinks=followlinks,
67                                         hidden=hidden)
68     }
69 
70 
71 def from_yaml(path, ignore=(ValueError, NotImplementedError), followlinks=True,
72               hidden=False):
73     """Construct a dictionary of resources from a YAML specification.
74 
75     Parameters
76     ----------
77     path : str
78         Path to a YAML specification of resources to load
79     ignore : tuple of Exception, optional
80         Ignore these exceptions when calling resource
81     followlinks : bool, optional
82         Follow symbolic links
83     hidden : bool, optional
84         Load hidden files
85 
86     Returns
87     -------
88     dict
89         A dictionary mapping top level keys in a YAML file to resources.
90 
91     See Also
92     --------
93     spider : Traverse a directory tree for resources
94     """
95     resources = {}
96     for name, info in yaml.load(path.read()).items():
97         if 'source' not in info:
98             raise ValueError('source key not found for data source named %r' %
99                              name)
100         source = info['source']
101         if os.path.isdir(source):
102             resources[name] = spider(os.path.expanduser(source),
103                                      ignore=ignore,
104                                      followlinks=followlinks,
105                                      hidden=hidden)
106         else:
107             resources[name] = resource(source, dshape=info.get('dshape'))
108     return resources
109 
110 
111 def _parse_args():
112     p = argparse.ArgumentParser(
113         formatter_class=argparse.ArgumentDefaultsHelpFormatter)
114     p.add_argument('path', type=argparse.FileType('r'), nargs='?',
115                    default=sys.stdin,
116                    help='A YAML file specifying the resources to load')
117     p.add_argument('-p', '--port', type=int, default=DEFAULT_PORT,
118                    help='Port number')
119     p.add_argument('-H', '--host', type=str, default='127.0.0.1',
120                    help='Host name. Use 0.0.0.0 to listen on all public IPs')
121     p.add_argument('-l', '--follow-links', action='store_true',
122                    help='Follow links when listing files')
123     p.add_argument('-e', '--ignored-exception', nargs='+',
124                    default=['Exception'],
125                    help='Exceptions to ignore when calling resource on a file')
126     p.add_argument('-d', '--hidden', action='store_true',
127                    help='Call resource on hidden files')
128     p.add_argument('-D', '--debug', action='store_true',
129                    help='Start the Flask server in debug mode')
130     return p.parse_args()
131 
132 
133 def _main():
134     args = _parse_args()
135     ignore = tuple(getattr(builtins, e) for e in args.ignored_exception)
136     resources = from_yaml(args.path,
137                           ignore=ignore,
138                           followlinks=args.follow_links,
139                           hidden=args.hidden)
140     Server(resources).run(host=args.host, port=args.port, debug=args.debug)
141 
142 
143 if __name__ == '__main__':
144     _main()
145
```

Path: `blaze/server/__init__.py`
Content:
```
1 from __future__ import absolute_import, division, print_function
2 
3 from .server import Server, to_tree, from_tree, api
4 from .spider import spider, from_yaml
5 from .client import Client
6 from .serialization import (
7     SerializationFormat,
8     all_formats,
9     json as json_format,
10     pickle as pickle_format,
11     msgpack as msgpack_format,
12 )
13 
14 
15 __all__ = [
16     'Client',
17     'SerializationFormat',
18     'Server',
19     'spider',
20     'from_yaml',
21     'all_formats',
22     'api',
23     'from_tree',
24     'json_format',
25     'msgpack_format',
26     'pickle_format',
27     'to_tree',
28 ]
29
```
--- 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/blaze/server/__init__.py b/blaze/server/__init__.py
--- a/blaze/server/__init__.py
+++ b/blaze/server/__init__.py
@@ -1,7 +1,7 @@
 from __future__ import absolute_import, division, print_function
 
 from .server import Server, to_tree, from_tree, api
-from .spider import spider, from_yaml
+from .spider import data_spider, from_yaml
 from .client import Client
 from .serialization import (
     SerializationFormat,
@@ -16,7 +16,7 @@
     'Client',
     'SerializationFormat',
     'Server',
-    'spider',
+    'data_spider',
     'from_yaml',
     'all_formats',
     'api',
diff --git a/blaze/server/spider.py b/blaze/server/spider.py
--- a/blaze/server/spider.py
+++ b/blaze/server/spider.py
@@ -19,7 +19,7 @@
     import builtins
 
 
-__all__ = 'spider', 'from_yaml'
+__all__ = 'data_spider', 'from_yaml'
 
 
 def _spider(resource_path, ignore, followlinks, hidden):
@@ -41,9 +41,11 @@
     return resources
 
 
-def spider(path, ignore=(ValueError, NotImplementedError), followlinks=True,
-           hidden=False):
-    """Traverse a directory and call ``odo.resource`` on its contentso
+def data_spider(path,
+                ignore=(ValueError, NotImplementedError),
+                followlinks=True,
+                hidden=False):
+    """Traverse a directory and call ``odo.resource`` on its contents.
 
     Parameters
     ----------
@@ -61,6 +63,8 @@
     dict
         Possibly nested dictionary of containing basenames mapping to resources
     """
+    # NOTE: this is named `data_spider` rather than just `spider` to
+    # disambiguate this function from the `blaze.server.spider` module.
     return {
         os.path.basename(path): _spider(path, ignore=ignore,
                                         followlinks=followlinks,
@@ -90,7 +94,7 @@
 
     See Also
     --------
-    spider : Traverse a directory tree for resources
+    data_spider : Traverse a directory tree for resources
     """
     resources = {}
     for name, info in yaml.load(path.read()).items():
@@ -99,10 +103,10 @@
                              name)
         source = info['source']
         if os.path.isdir(source):
-            resources[name] = spider(os.path.expanduser(source),
-                                     ignore=ignore,
-                                     followlinks=followlinks,
-                                     hidden=hidden)
+            resources[name] = data_spider(os.path.expanduser(source),
+                                          ignore=ignore,
+                                          followlinks=followlinks,
+                                          hidden=hidden)
         else:
             resources[name] = resource(source, dshape=info.get('dshape'))
     return resources

{"golden_diff": "diff --git a/blaze/server/__init__.py b/blaze/server/__init__.py\n--- a/blaze/server/__init__.py\n+++ b/blaze/server/__init__.py\n@@ -1,7 +1,7 @@\n from __future__ import absolute_import, division, print_function\n \n from .server import Server, to_tree, from_tree, api\n-from .spider import spider, from_yaml\n+from .spider import data_spider, from_yaml\n from .client import Client\n from .serialization import (\n     SerializationFormat,\n@@ -16,7 +16,7 @@\n     'Client',\n     'SerializationFormat',\n     'Server',\n-    'spider',\n+    'data_spider',\n     'from_yaml',\n     'all_formats',\n     'api',\ndiff --git a/blaze/server/spider.py b/blaze/server/spider.py\n--- a/blaze/server/spider.py\n+++ b/blaze/server/spider.py\n@@ -19,7 +19,7 @@\n     import builtins\n \n \n-__all__ = 'spider', 'from_yaml'\n+__all__ = 'data_spider', 'from_yaml'\n \n \n def _spider(resource_path, ignore, followlinks, hidden):\n@@ -41,9 +41,11 @@\n     return resources\n \n \n-def spider(path, ignore=(ValueError, NotImplementedError), followlinks=True,\n-           hidden=False):\n-    \"\"\"Traverse a directory and call ``odo.resource`` on its contentso\n+def data_spider(path,\n+                ignore=(ValueError, NotImplementedError),\n+                followlinks=True,\n+                hidden=False):\n+    \"\"\"Traverse a directory and call ``odo.resource`` on its contents.\n \n     Parameters\n     ----------\n@@ -61,6 +63,8 @@\n     dict\n         Possibly nested dictionary of containing basenames mapping to resources\n     \"\"\"\n+    # NOTE: this is named `data_spider` rather than just `spider` to\n+    # disambiguate this function from the `blaze.server.spider` module.\n     return {\n         os.path.basename(path): _spider(path, ignore=ignore,\n                                         followlinks=followlinks,\n@@ -90,7 +94,7 @@\n \n     See Also\n     --------\n-    spider : Traverse a directory tree for resources\n+    data_spider : Traverse a directory tree for resources\n     \"\"\"\n     resources = {}\n     for name, info in yaml.load(path.read()).items():\n@@ -99,10 +103,10 @@\n                              name)\n         source = info['source']\n         if os.path.isdir(source):\n-            resources[name] = spider(os.path.expanduser(source),\n-                                     ignore=ignore,\n-                                     followlinks=followlinks,\n-                                     hidden=hidden)\n+            resources[name] = data_spider(os.path.expanduser(source),\n+                                          ignore=ignore,\n+                                          followlinks=followlinks,\n+                                          hidden=hidden)\n         else:\n             resources[name] = resource(source, dshape=info.get('dshape'))\n     return resources\n", "issue": "Issue running blaze-server in 0.9.0 release\n```\n$ python --version\nPython 3.4.4 :: Continuum Analytics, Inc.\n\n$ python -c 'import blaze; print(blaze.__version__)'\n0.9.0\n\n$ blaze-server ./foo.yaml\nTraceback (most recent call last):\n  File \"/Users/ksmith/anaconda/envs/test-blaze-0.9.0/bin/blaze-server\", line 6, in <module>\n    sys.exit(blaze.server.spider._main())\nAttributeError: 'function' object has no attribute '_main'\n```\n\nThe best I can tell, this issue is related to the `import blaze.server.spider` line, and an ambiguity in this `import`.  There's both a `blaze/server/spider.py` module, and inside `blaze/server/__init__.py` is a `from .spider import spider`, which imports the spider _function_ in the `blaze.server` namespace.\n\nThe strange thing is that this particular logic is unchanged since Blaze 0.8.3, and `blaze-server` worked fine then.\n\nIn any case, dealiasing the `spider` name in `blaze.server` is a good idea anyway to rule out this issue once and for all.  Fix forthcoming.\n\n", "before_files": [{"content": "#!/usr/bin/env python\n\nfrom __future__ import absolute_import\n\nimport os\nimport sys\nimport argparse\n\nimport yaml\n\nfrom odo import resource\nfrom odo.utils import ignoring\n\nfrom .server import Server, DEFAULT_PORT\n\ntry:\n    import __builtin__ as builtins\nexcept ImportError:\n    import builtins\n\n\n__all__ = 'spider', 'from_yaml'\n\n\ndef _spider(resource_path, ignore, followlinks, hidden):\n    resources = {}\n    for filename in (os.path.join(resource_path, x)\n                     for x in os.listdir(resource_path)):\n        basename = os.path.basename(filename)\n        if (basename.startswith(os.curdir) and not hidden or\n                os.path.islink(filename) and not followlinks):\n            continue\n        if os.path.isdir(filename):\n            new_resources = _spider(filename, ignore=ignore,\n                                    followlinks=followlinks, hidden=hidden)\n            if new_resources:\n                resources[basename] = new_resources\n        else:\n            with ignoring(*ignore):\n                resources[basename] = resource(filename)\n    return resources\n\n\ndef spider(path, ignore=(ValueError, NotImplementedError), followlinks=True,\n           hidden=False):\n    \"\"\"Traverse a directory and call ``odo.resource`` on its contentso\n\n    Parameters\n    ----------\n    path : str\n        Path to a directory of resources to load\n    ignore : tuple of Exception, optional\n        Ignore these exceptions when calling resource\n    followlinks : bool, optional\n        Follow symbolic links\n    hidden : bool, optional\n        Load hidden files\n\n    Returns\n    -------\n    dict\n        Possibly nested dictionary of containing basenames mapping to resources\n    \"\"\"\n    return {\n        os.path.basename(path): _spider(path, ignore=ignore,\n                                        followlinks=followlinks,\n                                        hidden=hidden)\n    }\n\n\ndef from_yaml(path, ignore=(ValueError, NotImplementedError), followlinks=True,\n              hidden=False):\n    \"\"\"Construct a dictionary of resources from a YAML specification.\n\n    Parameters\n    ----------\n    path : str\n        Path to a YAML specification of resources to load\n    ignore : tuple of Exception, optional\n        Ignore these exceptions when calling resource\n    followlinks : bool, optional\n        Follow symbolic links\n    hidden : bool, optional\n        Load hidden files\n\n    Returns\n    -------\n    dict\n        A dictionary mapping top level keys in a YAML file to resources.\n\n    See Also\n    --------\n    spider : Traverse a directory tree for resources\n    \"\"\"\n    resources = {}\n    for name, info in yaml.load(path.read()).items():\n        if 'source' not in info:\n            raise ValueError('source key not found for data source named %r' %\n                             name)\n        source = info['source']\n        if os.path.isdir(source):\n            resources[name] = spider(os.path.expanduser(source),\n                                     ignore=ignore,\n                                     followlinks=followlinks,\n                                     hidden=hidden)\n        else:\n            resources[name] = resource(source, dshape=info.get('dshape'))\n    return resources\n\n\ndef _parse_args():\n    p = argparse.ArgumentParser(\n        formatter_class=argparse.ArgumentDefaultsHelpFormatter)\n    p.add_argument('path', type=argparse.FileType('r'), nargs='?',\n                   default=sys.stdin,\n                   help='A YAML file specifying the resources to load')\n    p.add_argument('-p', '--port', type=int, default=DEFAULT_PORT,\n                   help='Port number')\n    p.add_argument('-H', '--host', type=str, default='127.0.0.1',\n                   help='Host name. Use 0.0.0.0 to listen on all public IPs')\n    p.add_argument('-l', '--follow-links', action='store_true',\n                   help='Follow links when listing files')\n    p.add_argument('-e', '--ignored-exception', nargs='+',\n                   default=['Exception'],\n                   help='Exceptions to ignore when calling resource on a file')\n    p.add_argument('-d', '--hidden', action='store_true',\n                   help='Call resource on hidden files')\n    p.add_argument('-D', '--debug', action='store_true',\n                   help='Start the Flask server in debug mode')\n    return p.parse_args()\n\n\ndef _main():\n    args = _parse_args()\n    ignore = tuple(getattr(builtins, e) for e in args.ignored_exception)\n    resources = from_yaml(args.path,\n                          ignore=ignore,\n                          followlinks=args.follow_links,\n                          hidden=args.hidden)\n    Server(resources).run(host=args.host, port=args.port, debug=args.debug)\n\n\nif __name__ == '__main__':\n    _main()\n", "path": "blaze/server/spider.py"}, {"content": "from __future__ import absolute_import, division, print_function\n\nfrom .server import Server, to_tree, from_tree, api\nfrom .spider import spider, from_yaml\nfrom .client import Client\nfrom .serialization import (\n    SerializationFormat,\n    all_formats,\n    json as json_format,\n    pickle as pickle_format,\n    msgpack as msgpack_format,\n)\n\n\n__all__ = [\n    'Client',\n    'SerializationFormat',\n    'Server',\n    'spider',\n    'from_yaml',\n    'all_formats',\n    'api',\n    'from_tree',\n    'json_format',\n    'msgpack_format',\n    'pickle_format',\n    'to_tree',\n]\n", "path": "blaze/server/__init__.py"}], "after_files": [{"content": "#!/usr/bin/env python\n\nfrom __future__ import absolute_import\n\nimport os\nimport sys\nimport argparse\n\nimport yaml\n\nfrom odo import resource\nfrom odo.utils import ignoring\n\nfrom .server import Server, DEFAULT_PORT\n\ntry:\n    import __builtin__ as builtins\nexcept ImportError:\n    import builtins\n\n\n__all__ = 'data_spider', 'from_yaml'\n\n\ndef _spider(resource_path, ignore, followlinks, hidden):\n    resources = {}\n    for filename in (os.path.join(resource_path, x)\n                     for x in os.listdir(resource_path)):\n        basename = os.path.basename(filename)\n        if (basename.startswith(os.curdir) and not hidden or\n                os.path.islink(filename) and not followlinks):\n            continue\n        if os.path.isdir(filename):\n            new_resources = _spider(filename, ignore=ignore,\n                                    followlinks=followlinks, hidden=hidden)\n            if new_resources:\n                resources[basename] = new_resources\n        else:\n            with ignoring(*ignore):\n                resources[basename] = resource(filename)\n    return resources\n\n\ndef data_spider(path,\n                ignore=(ValueError, NotImplementedError),\n                followlinks=True,\n                hidden=False):\n    \"\"\"Traverse a directory and call ``odo.resource`` on its contents.\n\n    Parameters\n    ----------\n    path : str\n        Path to a directory of resources to load\n    ignore : tuple of Exception, optional\n        Ignore these exceptions when calling resource\n    followlinks : bool, optional\n        Follow symbolic links\n    hidden : bool, optional\n        Load hidden files\n\n    Returns\n    -------\n    dict\n        Possibly nested dictionary of containing basenames mapping to resources\n    \"\"\"\n    # NOTE: this is named `data_spider` rather than just `spider` to\n    # disambiguate this function from the `blaze.server.spider` module.\n    return {\n        os.path.basename(path): _spider(path, ignore=ignore,\n                                        followlinks=followlinks,\n                                        hidden=hidden)\n    }\n\n\ndef from_yaml(path, ignore=(ValueError, NotImplementedError), followlinks=True,\n              hidden=False):\n    \"\"\"Construct a dictionary of resources from a YAML specification.\n\n    Parameters\n    ----------\n    path : str\n        Path to a YAML specification of resources to load\n    ignore : tuple of Exception, optional\n        Ignore these exceptions when calling resource\n    followlinks : bool, optional\n        Follow symbolic links\n    hidden : bool, optional\n        Load hidden files\n\n    Returns\n    -------\n    dict\n        A dictionary mapping top level keys in a YAML file to resources.\n\n    See Also\n    --------\n    data_spider : Traverse a directory tree for resources\n    \"\"\"\n    resources = {}\n    for name, info in yaml.load(path.read()).items():\n        if 'source' not in info:\n            raise ValueError('source key not found for data source named %r' %\n                             name)\n        source = info['source']\n        if os.path.isdir(source):\n            resources[name] = data_spider(os.path.expanduser(source),\n                                          ignore=ignore,\n                                          followlinks=followlinks,\n                                          hidden=hidden)\n        else:\n            resources[name] = resource(source, dshape=info.get('dshape'))\n    return resources\n\n\ndef _parse_args():\n    p = argparse.ArgumentParser(\n        formatter_class=argparse.ArgumentDefaultsHelpFormatter)\n    p.add_argument('path', type=argparse.FileType('r'), nargs='?',\n                   default=sys.stdin,\n                   help='A YAML file specifying the resources to load')\n    p.add_argument('-p', '--port', type=int, default=DEFAULT_PORT,\n                   help='Port number')\n    p.add_argument('-H', '--host', type=str, default='127.0.0.1',\n                   help='Host name. Use 0.0.0.0 to listen on all public IPs')\n    p.add_argument('-l', '--follow-links', action='store_true',\n                   help='Follow links when listing files')\n    p.add_argument('-e', '--ignored-exception', nargs='+',\n                   default=['Exception'],\n                   help='Exceptions to ignore when calling resource on a file')\n    p.add_argument('-d', '--hidden', action='store_true',\n                   help='Call resource on hidden files')\n    p.add_argument('-D', '--debug', action='store_true',\n                   help='Start the Flask server in debug mode')\n    return p.parse_args()\n\n\ndef _main():\n    args = _parse_args()\n    ignore = tuple(getattr(builtins, e) for e in args.ignored_exception)\n    resources = from_yaml(args.path,\n                          ignore=ignore,\n                          followlinks=args.follow_links,\n                          hidden=args.hidden)\n    Server(resources).run(host=args.host, port=args.port, debug=args.debug)\n\n\nif __name__ == '__main__':\n    _main()\n", "path": "blaze/server/spider.py"}, {"content": "from __future__ import absolute_import, division, print_function\n\nfrom .server import Server, to_tree, from_tree, api\nfrom .spider import data_spider, from_yaml\nfrom .client import Client\nfrom .serialization import (\n    SerializationFormat,\n    all_formats,\n    json as json_format,\n    pickle as pickle_format,\n    msgpack as msgpack_format,\n)\n\n\n__all__ = [\n    'Client',\n    'SerializationFormat',\n    'Server',\n    'data_spider',\n    'from_yaml',\n    'all_formats',\n    'api',\n    'from_tree',\n    'json_format',\n    'msgpack_format',\n    'pickle_format',\n    'to_tree',\n]\n", "path": "blaze/server/__init__.py"}]}