title: Python & setuptools - 'No module named...'
body: <p>I'm trying to package an app I've written in Python, and am using setuptools with find_packages to do so. If I run <code>python setup.py develop</code> (or <code>install</code>) I get an ImportError:</p>
  
  <pre><code>Traceback (most recent call last):
    File "c:\Python34\Scripts\jiragen-script.py", line 9, in &lt;module&gt;
      load_entry_point('jiragen==1.0', 'console_scripts', 'jiragen')()
    File "x:\jira\jiragen\jiragen\main.py", line 8, in main
      import jira_parser, worklogs, exporter
  ImportError: No module named 'jira_parser'
  </code></pre>
  
  <p>jira_parser.py, worklogs.py and exporter.py all exist in the same directory as main.py. Here's my setup.py:</p>
  
  <pre><code>from setuptools import setup, find_packages
  
  setup(
          name='jiragen',
          version='1.0',
          packages = find_packages(),
          py_modules = [
              'jiragen.main', 
              'jiragen.jira_parser'
              ],
          install_requires=[
              'PyYAML',
              'XlsxWriter',
              'jsonpickle',
              'requests'
              ],
          entry_points={
              'console_scripts': [
                  'jiragen = jiragen.main:main'
                  ]
              }
          )
  </code></pre>
  
  <p>Note that I explicity added items to py_modules to see if that would make any difference - but python still complains it can't find jira_parser. Exactly the same error with just <code>find_packages</code> and no <code>py_modules</code>. I've tried adding the packages in explicitly too.</p>
  
  <p>My directory structure looks like:</p>
  
  <pre><code>jiragen
  |--setup.py
  |--jiragen/
  |--|--__init__.py
  |--|--__main__.py
  |--|--main.py
  |--|--jira_parser.py
  |--|--worklogs.py
  |--|--exporter.py
  |--|--excel/
  |--|--|--__init__.py
  |--|--|--(other .py files..)
  </code></pre>
  
  <p>What am I missing here?</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>Solved - Needed to change the target in <code>'console_scripts'</code> from <code>jiragen.main:main</code> to just <code>jiragen:main</code>, and add the line <code>package_dir = {'': 'jiragen'}</code></p>