prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  Blaze server yaml file error
  Testing the Blaze server from a file and getting the following error:
  
  ``` python
  $ blaze-server server.yaml
  Traceback (most recent call last):
    File "/anaconda/envs/ep-blaze/bin/blaze-server", line 6, in <module>
      sys.exit(_main())
    File "/anaconda/envs/ep-blaze/lib/python2.7/site-packages/blaze/server/spider.py", line 130, in _main
      ignore = tuple(getattr(__builtins__, e) for e in args.ignored_exception)
    File "/anaconda/envs/ep-blaze/lib/python2.7/site-packages/blaze/server/spider.py", line 130, in <genexpr>
      ignore = tuple(getattr(__builtins__, e) for e in args.ignored_exception)
  AttributeError: 'dict' object has no attribute 'Exception'
  ```
  
  I believe problem is in this line:
  https://github.com/ContinuumIO/blaze/blob/06991f6d368f23700019e36b337ea2800f37ab14/blaze/server/spider.py#L130
  when no ignored_exception in the args is passed.
  
  
  --- 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 
  17 __all__ = 'spider', 'from_yaml'
  18 
  19 
  20 def _spider(resource_path, ignore, followlinks, hidden):
  21     resources = {}
  22     for filename in (os.path.join(resource_path, x)
  23                      for x in os.listdir(resource_path)):
  24         basename = os.path.basename(filename)
  25         if (basename.startswith(os.curdir) and not hidden or
  26                 os.path.islink(filename) and not followlinks):
  27             continue
  28         if os.path.isdir(filename):
  29             new_resources = _spider(filename, ignore=ignore,
  30                                     followlinks=followlinks, hidden=hidden)
  31             if new_resources:
  32                 resources[basename] = new_resources
  33         else:
  34             with ignoring(*ignore):
  35                 resources[basename] = resource(filename)
  36     return resources
  37 
  38 
  39 def spider(path, ignore=(ValueError, NotImplementedError), followlinks=True,
  40            hidden=False):
  41     """Traverse a directory and call ``odo.resource`` on its contentso
  42 
  43     Parameters
  44     ----------
  45     path : str
  46         Path to a directory of resources to load
  47     ignore : tuple of Exception, optional
  48         Ignore these exceptions when calling resource
  49     followlinks : bool, optional
  50         Follow symbolic links
  51     hidden : bool, optional
  52         Load hidden files
  53 
  54     Returns
  55     -------
  56     dict
  57         Possibly nested dictionary of containing basenames mapping to resources
  58     """
  59     return {
  60         os.path.basename(path): _spider(path, ignore=ignore,
  61                                         followlinks=followlinks,
  62                                         hidden=hidden)
  63     }
  64 
  65 
  66 def from_yaml(path, ignore=(ValueError, NotImplementedError), followlinks=True,
  67               hidden=False):
  68     """Construct a dictionary of resources from a YAML specification.
  69 
  70     Parameters
  71     ----------
  72     path : str
  73         Path to a YAML specification of resources to load
  74     ignore : tuple of Exception, optional
  75         Ignore these exceptions when calling resource
  76     followlinks : bool, optional
  77         Follow symbolic links
  78     hidden : bool, optional
  79         Load hidden files
  80 
  81     Returns
  82     -------
  83     dict
  84         A dictionary mapping top level keys in a YAML file to resources.
  85 
  86     See Also
  87     --------
  88     spider : Traverse a directory tree for resources
  89     """
  90     resources = {}
  91     for name, info in yaml.load(path.read()).items():
  92         if 'source' not in info:
  93             raise ValueError('source key not found for data source named %r' %
  94                              name)
  95         source = info['source']
  96         if os.path.isdir(source):
  97             resources[name] = spider(os.path.expanduser(source),
  98                                      ignore=ignore,
  99                                      followlinks=followlinks,
  100                                      hidden=hidden)
  101         else:
  102             resources[name] = resource(source, dshape=info.get('dshape'))
  103     return resources
  104 
  105 
  106 def _parse_args():
  107     p = argparse.ArgumentParser(
  108         formatter_class=argparse.ArgumentDefaultsHelpFormatter)
  109     p.add_argument('path', type=argparse.FileType('r'), nargs='?',
  110                    default=sys.stdin,
  111                    help='A YAML file specifying the resources to load')
  112     p.add_argument('-p', '--port', type=int, default=DEFAULT_PORT,
  113                    help='Port number')
  114     p.add_argument('-H', '--host', type=str, default='127.0.0.1',
  115                    help='Host name. Use 0.0.0.0 to listen on all public IPs')
  116     p.add_argument('-l', '--follow-links', action='store_true',
  117                    help='Follow links when listing files')
  118     p.add_argument('-e', '--ignored-exception', nargs='*',
  119                    default=['Exception'],
  120                    help='Exceptions to ignore when calling resource on a file')
  121     p.add_argument('-d', '--hidden', action='store_true',
  122                    help='Call resource on hidden files')
  123     p.add_argument('-D', '--debug', action='store_true',
  124                    help='Start the Flask server in debug mode')
  125     return p.parse_args()
  126 
  127 
  128 def _main():
  129     args = _parse_args()
  130     ignore = tuple(getattr(__builtins__, e) for e in args.ignored_exception)
  131     resources = from_yaml(args.path,
  132                           ignore=ignore,
  133                           followlinks=args.follow_links,
  134                           hidden=args.hidden)
  135     Server(resources).run(host=args.host, port=args.port, debug=args.debug)
  136 
  137 
  138 if __name__ == '__main__':
  139     _main()
  140
  ```
  --- 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()
  
  ```
  
golden_diff: diff --git a/blaze/server/spider.py b/blaze/server/spider.py
  --- a/blaze/server/spider.py
  +++ b/blaze/server/spider.py
  @@ -13,6 +13,11 @@
   
   from .server import Server, DEFAULT_PORT
   
  +try:
  +    import __builtin__ as builtins
  +except ImportError:
  +    import builtins
  +
   
   __all__ = 'spider', 'from_yaml'
   
  @@ -115,7 +120,7 @@
                      help='Host name. Use 0.0.0.0 to listen on all public IPs')
       p.add_argument('-l', '--follow-links', action='store_true',
                      help='Follow links when listing files')
  -    p.add_argument('-e', '--ignored-exception', nargs='*',
  +    p.add_argument('-e', '--ignored-exception', nargs='+',
                      default=['Exception'],
                      help='Exceptions to ignore when calling resource on a file')
       p.add_argument('-d', '--hidden', action='store_true',
  @@ -127,7 +132,7 @@
   
   def _main():
       args = _parse_args()
  -    ignore = tuple(getattr(__builtins__, e) for e in args.ignored_exception)
  +    ignore = tuple(getattr(builtins, e) for e in args.ignored_exception)
       resources = from_yaml(args.path,
                             ignore=ignore,
                             followlinks=args.follow_links,
  
verification_info: {"golden_diff": "diff --git a/blaze/server/spider.py b/blaze/server/spider.py\n--- a/blaze/server/spider.py\n+++ b/blaze/server/spider.py\n@@ -13,6 +13,11 @@\n \n from .server import Server, DEFAULT_PORT\n \n+try:\n+    import __builtin__ as builtins\n+except ImportError:\n+    import builtins\n+\n \n __all__ = 'spider', 'from_yaml'\n \n@@ -115,7 +120,7 @@\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+    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@@ -127,7 +132,7 @@\n \n def _main():\n     args = _parse_args()\n-    ignore = tuple(getattr(__builtins__, e) for e in args.ignored_exception)\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", "issue": "Blaze server yaml file error\nTesting the Blaze server from a file and getting the following error:\n\n``` python\n$ blaze-server server.yaml\nTraceback (most recent call last):\n  File \"/anaconda/envs/ep-blaze/bin/blaze-server\", line 6, in <module>\n    sys.exit(_main())\n  File \"/anaconda/envs/ep-blaze/lib/python2.7/site-packages/blaze/server/spider.py\", line 130, in _main\n    ignore = tuple(getattr(__builtins__, e) for e in args.ignored_exception)\n  File \"/anaconda/envs/ep-blaze/lib/python2.7/site-packages/blaze/server/spider.py\", line 130, in <genexpr>\n    ignore = tuple(getattr(__builtins__, e) for e in args.ignored_exception)\nAttributeError: 'dict' object has no attribute 'Exception'\n```\n\nI believe problem is in this line:\nhttps://github.com/ContinuumIO/blaze/blob/06991f6d368f23700019e36b337ea2800f37ab14/blaze/server/spider.py#L130\nwhen no ignored_exception in the args is passed.\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\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"}], "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__ = '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"}]}