title: module not found during load_entry_point in Python
body: <p>I'm trying to create an entry point for the main method in one of my python modules, and there seems to be trouble importing the module where that function lives.</p>
  
  <p>My setup.py looks like this:</p>
  
  <pre><code>...
  setup(name="awesome-tool",
        ...,
        entry_points={
            'console_scripts' : [
                'awesome-tool = awesome_tool.awesome_tool:main'
            ]
        }
  )
  </code></pre>
  
  <p>The project is organized like this:</p>
  
  <pre><code>awesome_tool
      |__ awesome_tool.py
      |__ __init__.py
  </code></pre>
  
  <p>It's <code>awesome_tool.py</code> that contains a function called main() that I want to make available in an executable called <code>awesome-tool</code>. When executing setup.py, all seems to go well. I can start a python prompt and do</p>
  
  <pre><code>&gt; import awesome_tool.awesome_tool
  &gt; # (all good here)
  </code></pre>
  
  <p>But when I try to invoke <code>awesome-tool</code> from the command-line, this is what happens:</p>
  
  <pre><code>Traceback (most recent call last):
    File ".../virtualenvs/awesome-tool/bin/awesome-tool", line 9, in &lt;module&gt;
      load_entry_point('awesome-tool==1.1.0', 'console_scripts', 'awesome-tool')()
    File "build/bdist.macosx-10.9-intel/egg/pkg_resources.py", line 378, in load_entry_point
      return get_distribution(dist).load_entry_point(group, name)
    File "build/bdist.macosx-10.9-intel/egg/pkg_resources.py", line 2566, in load_entry_point
      return ep.load()
    File "build/bdist.macosx-10.9-intel/egg/pkg_resources.py", line 2260, in load
      entry = __import__(self.module_name, globals(),globals(), ['__name__'])
  ImportError: No module named awesome_tool.awesome_tool
  </code></pre>
  
  <p>What? Wasn't I just able to import this from the python shell? I suspect that there's something funny going on with the python path, but I haven't been able to diagnose the problem. Any ideas?</p>
  
  <p>The problematic lines in the <code>awesome-tool</code> executable provided by <code>setup.py</code> seem to be the following:</p>
  
  <pre><code>from pkg_resources import load_entry_point
  load_entry_point("awesome-tool==1.1.0", "console_scripts", "awesome-tool")()
  </code></pre>
  
  <p>Also, I realize that it's very odd to have both a package and module share the same name ("awesome_tool"), but this is code I've inherited and I don't want to break backwards compatibility with renaming, though this may be inevitable in the future. If possible, I'd like to keep the names the way they are for now.</p>