Development of an internal social media platform with personalised dashboards for students
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

import_package_subpackage_module.py 2.2KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. # pylint: disable=I0011,C0301,W0611
  2. """I found some of my scripts trigger off an AttributeError in pylint
  3. 0.8.1 (with common 0.12.0 and astroid 0.13.1).
  4. Traceback (most recent call last):
  5. File "/usr/bin/pylint", line 4, in ?
  6. lint.Run(sys.argv[1:])
  7. File "/usr/lib/python2.4/site-packages/pylint/lint.py", line 729, in __init__
  8. linter.check(args)
  9. File "/usr/lib/python2.4/site-packages/pylint/lint.py", line 412, in check
  10. self.check_file(filepath, modname, checkers)
  11. File "/usr/lib/python2.4/site-packages/pylint/lint.py", line 426, in check_file
  12. astroid = self._check_file(filepath, modname, checkers)
  13. File "/usr/lib/python2.4/site-packages/pylint/lint.py", line 450, in _check_file
  14. self.check_astroid_module(astroid, checkers)
  15. File "/usr/lib/python2.4/site-packages/pylint/lint.py", line 494, in check_astroid_module
  16. self.astroid_events(astroid, [checker for checker in checkers
  17. File "/usr/lib/python2.4/site-packages/pylint/lint.py", line 511, in astroid_events
  18. self.astroid_events(child, checkers, _reversed_checkers)
  19. File "/usr/lib/python2.4/site-packages/pylint/lint.py", line 511, in astroid_events
  20. self.astroid_events(child, checkers, _reversed_checkers)
  21. File "/usr/lib/python2.4/site-packages/pylint/lint.py", line 508, in astroid_events
  22. checker.visit(astroid)
  23. File "/usr/lib/python2.4/site-packages/logilab/astroid/utils.py", line 84, in visit
  24. method(node)
  25. File "/usr/lib/python2.4/site-packages/pylint/checkers/variables.py", line 295, in visit_import
  26. self._check_module_attrs(node, module, name_parts[1:])
  27. File "/usr/lib/python2.4/site-packages/pylint/checkers/variables.py", line 357, in _check_module_attrs
  28. self.add_message('E0611', args=(name, module.name),
  29. AttributeError: Import instance has no attribute 'name'
  30. You can reproduce it by:
  31. (1) create package structure like the following:
  32. package/
  33. __init__.py
  34. subpackage/
  35. __init__.py
  36. module.py
  37. (2) in package/__init__.py write:
  38. import subpackage
  39. (3) run pylint with a script importing package.subpackage.module.
  40. """
  41. import package.subpackage.module
  42. __revision__ = '$Id: import_package_subpackage_module.py,v 1.1 2005-11-10 16:08:54 syt Exp $'