title: "ImportError: Cannot import name" for a module on the path using Sphinx 1.2b3
body: <p>I am using Sphinx to automatically build docs for a project I am working on. The docs were building fine, until I added another class to one of the modules. Now whenever I try to run the build, the new class is not imported.</p>
  
  <p>The error from the Sphinx error log: </p>
  
  <pre><code># Sphinx version: 1.2b3
  # Python version: 2.7.3
  # Docutils version: 0.9 release
  # Jinja2 version: 2.6
  # Loaded extensions:
  #   sphinxcontrib.httpdomain from C:\Python27\lib\site-packages\sphinxcontrib_httpdomain-1.2.1-py2.7.egg\sphinxcontrib\httpdomain.pyc
  #   sphinxcontrib.autohttp.flask from C:\Python27\lib\site-packages\sphinxcontrib_httpdomain-1.2.1-py2.7.egg\sphinxcontrib\autohttp\flask.pyc
  #   sphinx.ext.autodoc from C:\Python27\lib\site-packages\sphinx\ext\autodoc.pyc
  #   sphinx.ext.viewcode from C:\Python27\lib\site-packages\sphinx\ext\viewcode.pyc
  #   sphinx.ext.oldcmarkup from C:\Python27\lib\site-packages\sphinx\ext\oldcmarkup.pyc
  Traceback (most recent call last):
    File "C:\Python27\lib\site-packages\sphinx\cmdline.py", line 246, in main
      app.build(force_all, filenames)
    File "C:\Python27\lib\site-packages\sphinx\application.py", line 212, in build
      self.builder.build_update()
    File "C:\Python27\lib\site-packages\sphinx\builders\__init__.py", line 214, in build_update
      'out of date' % len(to_build))
    File "C:\Python27\lib\site-packages\sphinx\builders\__init__.py", line 234, in build
      purple, length):
    File "C:\Python27\lib\site-packages\sphinx\builders\__init__.py", line 134, in status_iterator
      for item in iterable:
    File "C:\Python27\lib\site-packages\sphinx\environment.py", line 470, in update_generator
      self.read_doc(docname, app=app)
    File "C:\Python27\lib\site-packages\sphinx\environment.py", line 618, in read_doc
      pub.publish()
    File "C:\Python27\lib\site-packages\docutils-0.9-py2.7.egg\docutils\core.py", line 221, in publish
      self.settings)
    File "C:\Python27\lib\site-packages\docutils-0.9-py2.7.egg\docutils\readers\__init__.py", line 69, in read
      self.parse()
    File "C:\Python27\lib\site-packages\docutils-0.9-py2.7.egg\docutils\readers\__init__.py", line 75, in parse
      self.parser.parse(self.input, document)
    File "C:\Python27\lib\site-packages\docutils-0.9-py2.7.egg\docutils\parsers\rst\__init__.py", line 162, in parse
      self.statemachine.run(inputlines, document, inliner=self.inliner)
    File "C:\Python27\lib\site-packages\docutils-0.9-py2.7.egg\docutils\parsers\rst\states.py", line 174, in run
      input_source=document['source'])
    File "C:\Python27\lib\site-packages\docutils-0.9-py2.7.egg\docutils\statemachine.py", line 239, in run
      context, state, transitions)
    File "C:\Python27\lib\site-packages\docutils-0.9-py2.7.egg\docutils\statemachine.py", line 460, in check_line
      return method(match, context, next_state)
    File "C:\Python27\lib\site-packages\docutils-0.9-py2.7.egg\docutils\parsers\rst\states.py", line 2706, in underline
      self.section(title, source, style, lineno - 1, messages)
    File "C:\Python27\lib\site-packages\docutils-0.9-py2.7.egg\docutils\parsers\rst\states.py", line 331, in section
      self.new_subsection(title, lineno, messages)
    File "C:\Python27\lib\site-packages\docutils-0.9-py2.7.egg\docutils\parsers\rst\states.py", line 399, in new_subsection
      node=section_node, match_titles=True)
    File "C:\Python27\lib\site-packages\docutils-0.9-py2.7.egg\docutils\parsers\rst\states.py", line 286, in nested_parse
      node=node, match_titles=match_titles)
    File "C:\Python27\lib\site-packages\docutils-0.9-py2.7.egg\docutils\parsers\rst\states.py", line 199, in run
      results = StateMachineWS.run(self, input_lines, input_offset)
    File "C:\Python27\lib\site-packages\docutils-0.9-py2.7.egg\docutils\statemachine.py", line 239, in run
      context, state, transitions)
    File "C:\Python27\lib\site-packages\docutils-0.9-py2.7.egg\docutils\statemachine.py", line 460, in check_line
      return method(match, context, next_state)
    File "C:\Python27\lib\site-packages\docutils-0.9-py2.7.egg\docutils\parsers\rst\states.py", line 2706, in underline
      self.section(title, source, style, lineno - 1, messages)
    File "C:\Python27\lib\site-packages\docutils-0.9-py2.7.egg\docutils\parsers\rst\states.py", line 331, in section
      self.new_subsection(title, lineno, messages)
    File "C:\Python27\lib\site-packages\docutils-0.9-py2.7.egg\docutils\parsers\rst\states.py", line 399, in new_subsection
      node=section_node, match_titles=True)
    File "C:\Python27\lib\site-packages\docutils-0.9-py2.7.egg\docutils\parsers\rst\states.py", line 286, in nested_parse
      node=node, match_titles=match_titles)
    File "C:\Python27\lib\site-packages\docutils-0.9-py2.7.egg\docutils\parsers\rst\states.py", line 199, in run
      results = StateMachineWS.run(self, input_lines, input_offset)
    File "C:\Python27\lib\site-packages\docutils-0.9-py2.7.egg\docutils\statemachine.py", line 239, in run
      context, state, transitions)
    File "C:\Python27\lib\site-packages\docutils-0.9-py2.7.egg\docutils\statemachine.py", line 460, in check_line
      return method(match, context, next_state)
    File "C:\Python27\lib\site-packages\docutils-0.9-py2.7.egg\docutils\parsers\rst\states.py", line 2279, in explicit_markup
      nodelist, blank_finish = self.explicit_construct(match)
    File "C:\Python27\lib\site-packages\docutils-0.9-py2.7.egg\docutils\parsers\rst\states.py", line 2291, in explicit_construct
      return method(self, expmatch)
    File "C:\Python27\lib\site-packages\docutils-0.9-py2.7.egg\docutils\parsers\rst\states.py", line 2034, in directive
      directive_class, match, type_name, option_presets)
    File "C:\Python27\lib\site-packages\docutils-0.9-py2.7.egg\docutils\parsers\rst\states.py", line 2083, in run_directive
      result = directive_instance.run()
    File "C:\Python27\lib\site-packages\sphinxcontrib_httpdomain-1.2.1-py2.7.egg\sphinxcontrib\autohttp\flask.py", line 138, in run
      for line in self.make_rst():
    File "C:\Python27\lib\site-packages\sphinxcontrib_httpdomain-1.2.1-py2.7.egg\sphinxcontrib\autohttp\flask.py", line 97, in make_rst
      app = import_object(self.arguments[0])
    File "C:\Python27\lib\site-packages\sphinxcontrib_httpdomain-1.2.1-py2.7.egg\sphinxcontrib\autohttp\common.py", line 17, in import_object
      mod = __import__(module_name)
    File "E:\workspace_zach\API\api_serve.py", line 6, in &lt;module&gt;
      from BOBI import BOBI
    File "E:\workspace_zach\API\BOBI\__init__.py", line 13, in &lt;module&gt;
      from Lib.DBVersionTools import DBVersionNormalizer, DBVersionPolisher
  ImportError: cannot import name DBVersionPolisher
  </code></pre>
  
  <p>The module is on the path, and is within a folder with an <code>__init__.py</code> file. Sphinx is clearly able to import the first class, but not the second. Tests involving both classes work fine. I have deleted all of the old .pyc files, but that failed to resolve the issue. If I remove the second class from the import statement and comment out references to it, then the docs work without a problem.</p>
  
  <p>Any ideas on how to fix this issue, or failing that hide the import statements from sphinx (but not other scripts, like my tests)?</p>
  
  <p><strong>Additional code:</strong></p>
  
  <p>All import statements:</p>
  
  <pre><code>import Error
  import logging
  import re
  import Lib.globals as Globals
  from flask import Blueprint, jsonify, request, current_app, make_response
  from functools import update_wrapper
  from datetime import timedelta
  from Lib.VerifyCookie import verify, req_to_dict
  from Lib.MSSQLTools import MSSQLTools
  from Lib.DBVersionTools import DBVersionNormalizer, DBVersionPolisher
  </code></pre>
  
  <p>Sphinx extensions and path modifications:</p>
  
  <pre><code>sys.path.append('E:\\workspace_zach\\API')  # Root directory for the project
  
  extensions = [
      'sphinx.ext.autodoc',
      'sphinxcontrib.httpdomain',
      'sphinxcontrib.autohttp.flask',
      'sphinx.ext.autodoc',
      'sphinx.ext.viewcode',
  ]
  </code></pre>