Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AstroidError: module has no attribute '__path__' #7648

Closed
lukaszla opened this issue Oct 18, 2022 · 1 comment
Closed

AstroidError: module has no attribute '__path__' #7648

lukaszla opened this issue Oct 18, 2022 · 1 comment
Labels
Duplicate 🐫 Duplicate of an already existing issue

Comments

@lukaszla
Copy link

Bug description

Updating to latest pylint 2.15.3 updates astroid to 2.12.10 and error below happens

If I revert to use astroid to 2.12.9 (and pylint 2.15.2) error is gone

When parsing the following file:

import logging
import os
import re
import threading
from celery import Celery
from celery.signals import before_task_publish, task_prerun
from django.conf import settings

pylint crashed with a AstroidError and with the following stacktrace

Traceback (most recent call last):
  File "CODE\lib\site-packages\pylint\lint\pylinter.py", line 782, in _lint_file
    check_astroid_module(module)
  File "CODE\lib\site-packages\pylint\lint\pylinter.py", line 1049, in check_astroid_module
    retval = self._check_astroid_module(
  File "CODE\lib\site-packages\pylint\lint\pylinter.py", line 1099, in _check_astroid_module
    walker.walk(node)
  File "CODE\lib\site-packages\pylint\utils\ast_walker.py", line 93, in walk
    self.walk(child)
  File "CODE\lib\site-packages\pylint\utils\ast_walker.py", line 90, in walk
    callback(astroid)
  File "CODE\lib\site-packages\pylint\checkers\imports.py", line 523, in visit_importfrom
    self._add_imported_module(node, f"{imported_module.name}.{name}")
  File "CODE\lib\site-packages\pylint\checkers\imports.py", line 833, in _add_imported_module
    importedmodname = astroid.modutils.get_module_part(
  File "CODE\lib\site-packages\astroid\modutils.py", line 438, in get_module_part
    file_from_modpath(
  File "CODE\lib\site-packages\astroid\modutils.py", line 334, in file_from_modpath
    return file_info_from_modpath(modpath, path, context_file).location
  File "CODE\lib\site-packages\astroid\modutils.py", line 384, in file_info_from_modpath
    return _spec_from_modpath(modpath, path, context)
  File "CODE\lib\site-packages\astroid\modutils.py", line 590, in _spec_from_modpath
    found_spec = spec.find_spec(modpath, [context])
  File "CODE\lib\site-packages\astroid\interpreter\_import\spec.py", line 392, in find_spec
    finder, spec = _find_spec_with_path(
  File "CODE\lib\site-packages\astroid\interpreter\_import\spec.py", line 354, in _find_spec_with_path
    spec = finder_instance.find_module(
  File "CODE\lib\site-packages\astroid\interpreter\_import\spec.py", line 204, in find_module
    submodule_path = sys.modules[modname].__path__
AttributeError: module 'celery.signals' has no attribute '__path__'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "CODE\lib\site-packages\pylint\lint\pylinter.py", line 747, in _lint_files
    self._lint_file(fileitem, module, check_astroid_module)
  File "CODE\lib\site-packages\pylint\lint\pylinter.py", line 784, in _lint_file
    raise astroid.AstroidError from e
astroid.exceptions.AstroidError

Configuration

celery==5.2.7
pylint==2.15.3
astroid==2.12.10

Command used

pylint --load-plugins pylint_django --rcfile=.pylintrc

Pylint output

2022-10-18 14:34:26,037: celery.redirected[232]: AttributeError: module 'celery.signals' has no attribute '__path__'
************* Module module.base.celery
base\celery.py:1: [F0002(astroid-error), ] base\celery.py: Fatal error while checking 'base\celery.py'. Please open an issue in our bug tracker so we address this. There is a pre-filled template that you can use in '\pylint\pylint\Cache\pylint-crash-2022-10-18-14-34-26.txt'.

Expected behavior

There should be no error

Pylint version

pylint 2.15.3
astroid 2.12.10
Python 3.8.10 (tags/v3.8.10:3d8993a, May  3 2021, 11:48:03) [MSC v.1928 64 bit (AMD64)]

OS / Environment

Windows

Additional dependencies

celery==5.2.7

@lukaszla lukaszla added the Needs triage 📥 Just created, needs acknowledgment, triage, and proper labelling label Oct 18, 2022
@jacobtylerwalls
Copy link
Member

Thanks for the report. Duplicate of #7592. We're waiting on a patch release of astroid, but you can pin to astroid main if you need it sooner.

@jacobtylerwalls jacobtylerwalls closed this as not planned Won't fix, can't repro, duplicate, stale Oct 18, 2022
@jacobtylerwalls jacobtylerwalls added Duplicate 🐫 Duplicate of an already existing issue and removed Needs triage 📥 Just created, needs acknowledgment, triage, and proper labelling labels Oct 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Duplicate 🐫 Duplicate of an already existing issue
Projects
None yet
Development

No branches or pull requests

2 participants