question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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

See original GitHub issue

This seems to happen on py 3.4+ with unusual imports.

Here’s a failing Travis build: https://travis-ci.org/mgedmin/irclog2html/jobs/81338508

#!python
$ coverage run --source=irclog2html -m zope.testrunner.__init__ --test-path=src
Coverage.py warning: Module irclog2html was never imported.
Coverage.py warning: No data was collected.
Traceback (most recent call last):
  File "/home/travis/virtualenv/python3.4.2/bin/coverage", line 9, in <module>
    load_entry_point('coverage==4.0', 'console_scripts', 'coverage')()
  File "/home/travis/virtualenv/python3.4.2/lib/python3.4/site-packages/coverage/cmdline.py", line 694, in main
    status = CoverageScript().command_line(argv)
  File "/home/travis/virtualenv/python3.4.2/lib/python3.4/site-packages/coverage/cmdline.py", line 435, in command_line
    return self.do_run(options, args)
  File "/home/travis/virtualenv/python3.4.2/lib/python3.4/site-packages/coverage/cmdline.py", line 569, in do_run
    self.run_python_module(args[0], args)
  File "/home/travis/virtualenv/python3.4.2/lib/python3.4/site-packages/coverage/execfile.py", line 107, in run_python_module
    pathname, packagename = find_module(modulename)
  File "/home/travis/virtualenv/python3.4.2/lib/python3.4/site-packages/coverage/execfile.py", line 44, in find_module
    spec = importlib_util_find_spec(mod_main)
  File "/home/travis/virtualenv/python3.4.2/lib/python3.4/importlib/util.py", line 87, in find_spec
    return _find_spec(fullname, parent.__path__)
AttributeError: 'module' object has no attribute '__path__'

It should be reproducible by checking out https://github.com/mgedmin/irclog2html/tree/2154cf870f3073a71471bb2863be64827c3d90c1 and then running “tox -e py34”


Issue Analytics

  • State:closed
  • Created 8 years ago
  • Reactions:1
  • Comments:8 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
nedbatcommented, Nov 19, 2018

@Habush I would love to fix the problem, but I can’t unless I can reproduce it. Can you link me to your code, and instructions for how to configure the environment and run the tests?

0reactions
Habushcommented, Nov 19, 2018

I just ran coverage run -m tests.<test_file>. I think the issue is occurring because I am improting variables in init.py file. If I move those variables to other file then it works without an issue

Read more comments on GitHub >

github_iconTop Results From Across the Web

os.path doesn't exist: AttributeError: 'module' object has no ...
Looking through some other 'module' object has no attribute answers, the most common suggestion is that there must be another rogue os.py ...
Read more >
AttributeError: 'module' object has no attribute 'path' #4 - GitHub
Full error message: user@user:~/workspace/seeing3d$ python render.py ~/ownCloud/3D\ Models/Tools/hammer/ renderedmodels/ Known pipe types: ...
Read more >
AttributeError: module '01_parse' has no attribute 'path' - usage
I think it's because you're trying to execute a Python file as a module by running python -m , which won't work. There's...
Read more >
subscription-manager throws `AttributeError:'module' object ...
Unable to execute any subscription-manager command due to the error of AttributeError: 'module' object has no attribute 'PY2'.
Read more >
AttributeError: 'module' object has no attribute 'get_suffixes'
I am getting this error consistently when I run my module on GAE. The error is thrown by a core python module (imp)....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found