AttributeError: 'module' object has no attribute '__path__'

Jeff Bauer avatarJeff Bauer created an issue

Just a quick traceback dump before I forget to submit a bug ticket. ;-)

I'm running this as a non-app: ./manage.py test

Traceback (most recent call last):
  File "manage.py", line 11, in <module>
    execute_manager(settings)
  File "/home/jbauer/.virtualenvs/py272/lib/python2.7/site-packages/django/core/management/__init__.py", line 438, in execute_manager
    utility.execute()
  File "/home/jbauer/.virtualenvs/py272/lib/python2.7/site-packages/django/core/management/__init__.py", line 379, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/home/jbauer/.virtualenvs/py272/lib/python2.7/site-packages/django/core/management/base.py", line 191, in run_from_argv
    self.execute(*args, **options.__dict__)
  File "/home/jbauer/.virtualenvs/py272/lib/python2.7/site-packages/django/core/management/base.py", line 220, in execute
    output = self.handle(*args, **options)
  File "/home/jbauer/.virtualenvs/py272/lib/python2.7/site-packages/django/core/management/commands/test.py", line 37, in handle
    failures = test_runner.run_tests(test_labels)
  File "/home/jbauer/.virtualenvs/py272/lib/python2.7/site-packages/django_coverage/coverage_runner.py", line 90, in run_tests
    settings.COVERAGE_PATH_EXCLUDES)
  File "/home/jbauer/.virtualenvs/py272/lib/python2.7/site-packages/django_coverage/utils/module_tools/module_walker.py", line 133, in get_all_modules
    _get_all_modules(pkg_name, pkg, blacklist)
  File "/home/jbauer/.virtualenvs/py272/lib/python2.7/site-packages/django_coverage/utils/module_tools/module_walker.py", line 112, in _get_all_modules
    for p in pkg.__path__:
AttributeError: 'module' object has no attribute '__path__'

Comments (3)

  1. Terr

    I had the same problem. Turns out I had an (old, empty) directory with the same name as a Python package (permissions/, permissions.py[c]). The directory didn't contain a init.py, so I'm not sure why it was identified as a package.

    Deleting the directory fixed the problem, but improving package detection code would be better of course.

  2. Log in to comment
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.