[Bug 1651098] [NEW] RuntimeError: 'path' must be None or a list, not <class '_frozen_importlib_external._NamespacePath'>

Benjamin Drung bdrung at posteo.de
Mon Dec 19 11:09:00 UTC 2016


Public bug reported:

A simple "import ruamel.yaml" causes pylint3 to show a stack trace when
run inside a schroot session from sbuild:

echo "import ruamel.yaml" > test.py
pylint3 --reports=no test.py
No config file found, using default configuration
************* Module test
C:  1, 0: Missing module docstring (missing-docstring)
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/astroid/manager.py", line 172, in file_from_module_name
    value = self._mod_file_cache[(modname, contextfile)]
KeyError: ('ruamel.yaml', None)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/bin/pylint3", line 3, in <module>
    run_pylint()
  File "/usr/lib/python3/dist-packages/pylint/__init__.py", line 23, in run_pylint
    Run(sys.argv[1:])
  File "/usr/lib/python3/dist-packages/pylint/lint.py", line 1315, in __init__
    linter.check(args)
  File "/usr/lib/python3/dist-packages/pylint/lint.py", line 736, in check
    self._do_check(files_or_modules)
  File "/usr/lib/python3/dist-packages/pylint/lint.py", line 867, in _do_check
    self.check_astroid_module(ast_node, walker, rawcheckers, tokencheckers)
  File "/usr/lib/python3/dist-packages/pylint/lint.py", line 947, in check_astroid_module
    walker.walk(ast_node)
  File "/usr/lib/python3/dist-packages/pylint/utils.py", line 938, in walk
    self.walk(child)
  File "/usr/lib/python3/dist-packages/pylint/utils.py", line 935, in walk
    cb(astroid)
  File "/usr/lib/python3/dist-packages/pylint/checkers/variables.py", line 1009, in visit_import
    self._check_module_attrs(node, module, parts[1:])
  File "/usr/lib/python3/dist-packages/pylint/checkers/variables.py", line 1096, in _check_module_attrs
    module = next(module.getattr(name)[0].infer())
  File "/usr/lib/python3/dist-packages/astroid/scoped_nodes.py", line 92, in decorator
    nodes = [n for n in func(*args, **kwargs) if not isinstance(n, cls)]
  File "/usr/lib/python3/dist-packages/astroid/scoped_nodes.py", line 434, in getattr
    return [self.import_module(name, relative_only=True)]
  File "/usr/lib/python3/dist-packages/astroid/scoped_nodes.py", line 492, in import_module
    return MANAGER.ast_from_module_name(absmodname)
  File "/usr/lib/python3/dist-packages/astroid/manager.py", line 116, in ast_from_module_name
    filepath, mp_type = self.file_from_module_name(modname, context_file)
  File "/usr/lib/python3/dist-packages/astroid/manager.py", line 176, in file_from_module_name
    modname.split('.'), context_file=contextfile)
  File "/usr/lib/python3/dist-packages/astroid/modutils.py", line 369, in file_info_from_modpath
    return _file_from_modpath(modpath, path, context)
  File "/usr/lib/python3/dist-packages/astroid/modutils.py", line 582, in _file_from_modpath
    mtype, mp_filename = _module_file(modpath, path)
  File "/usr/lib/python3/dist-packages/astroid/modutils.py", line 670, in _module_file
    stream, mp_filename, mp_desc = imp.find_module(modname, path)
  File "/usr/lib/python3.5/imp.py", line 270, in find_module
    "not {}".format(type(path)))
RuntimeError: 'path' must be None or a list, not <class '_frozen_importlib_external._NamespacePath'>
debian/rules:7: recipe for target 'override_dh_auto_test' failed

You can reproduce this bug by creating a small Debian package, add
pylint3 and python3-ruamel.yaml to its build dependencies and add this
debian/rules snippet:

override_dh_auto_test:
	echo "import ruamel.yaml" > test.py
	pylint3 --reports=no test.py

Package versions:
* pylint3 1.5.6-1
* python3-astroid 1.4.8-1
* python3.5 3.5.2-9

Full list of packages is attached.

** Affects: pylint (Ubuntu)
     Importance: Undecided
         Status: New

** Attachment added: "package_versions"
   https://bugs.launchpad.net/bugs/1651098/+attachment/4793912/+files/package_versions

-- 
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to pylint in Ubuntu.
https://bugs.launchpad.net/bugs/1651098

Title:
  RuntimeError: 'path' must be None or a list, not <class
  '_frozen_importlib_external._NamespacePath'>

Status in pylint package in Ubuntu:
  New

Bug description:
  A simple "import ruamel.yaml" causes pylint3 to show a stack trace
  when run inside a schroot session from sbuild:

  echo "import ruamel.yaml" > test.py
  pylint3 --reports=no test.py
  No config file found, using default configuration
  ************* Module test
  C:  1, 0: Missing module docstring (missing-docstring)
  Traceback (most recent call last):
    File "/usr/lib/python3/dist-packages/astroid/manager.py", line 172, in file_from_module_name
      value = self._mod_file_cache[(modname, contextfile)]
  KeyError: ('ruamel.yaml', None)

  During handling of the above exception, another exception occurred:

  Traceback (most recent call last):
    File "/usr/bin/pylint3", line 3, in <module>
      run_pylint()
    File "/usr/lib/python3/dist-packages/pylint/__init__.py", line 23, in run_pylint
      Run(sys.argv[1:])
    File "/usr/lib/python3/dist-packages/pylint/lint.py", line 1315, in __init__
      linter.check(args)
    File "/usr/lib/python3/dist-packages/pylint/lint.py", line 736, in check
      self._do_check(files_or_modules)
    File "/usr/lib/python3/dist-packages/pylint/lint.py", line 867, in _do_check
      self.check_astroid_module(ast_node, walker, rawcheckers, tokencheckers)
    File "/usr/lib/python3/dist-packages/pylint/lint.py", line 947, in check_astroid_module
      walker.walk(ast_node)
    File "/usr/lib/python3/dist-packages/pylint/utils.py", line 938, in walk
      self.walk(child)
    File "/usr/lib/python3/dist-packages/pylint/utils.py", line 935, in walk
      cb(astroid)
    File "/usr/lib/python3/dist-packages/pylint/checkers/variables.py", line 1009, in visit_import
      self._check_module_attrs(node, module, parts[1:])
    File "/usr/lib/python3/dist-packages/pylint/checkers/variables.py", line 1096, in _check_module_attrs
      module = next(module.getattr(name)[0].infer())
    File "/usr/lib/python3/dist-packages/astroid/scoped_nodes.py", line 92, in decorator
      nodes = [n for n in func(*args, **kwargs) if not isinstance(n, cls)]
    File "/usr/lib/python3/dist-packages/astroid/scoped_nodes.py", line 434, in getattr
      return [self.import_module(name, relative_only=True)]
    File "/usr/lib/python3/dist-packages/astroid/scoped_nodes.py", line 492, in import_module
      return MANAGER.ast_from_module_name(absmodname)
    File "/usr/lib/python3/dist-packages/astroid/manager.py", line 116, in ast_from_module_name
      filepath, mp_type = self.file_from_module_name(modname, context_file)
    File "/usr/lib/python3/dist-packages/astroid/manager.py", line 176, in file_from_module_name
      modname.split('.'), context_file=contextfile)
    File "/usr/lib/python3/dist-packages/astroid/modutils.py", line 369, in file_info_from_modpath
      return _file_from_modpath(modpath, path, context)
    File "/usr/lib/python3/dist-packages/astroid/modutils.py", line 582, in _file_from_modpath
      mtype, mp_filename = _module_file(modpath, path)
    File "/usr/lib/python3/dist-packages/astroid/modutils.py", line 670, in _module_file
      stream, mp_filename, mp_desc = imp.find_module(modname, path)
    File "/usr/lib/python3.5/imp.py", line 270, in find_module
      "not {}".format(type(path)))
  RuntimeError: 'path' must be None or a list, not <class '_frozen_importlib_external._NamespacePath'>
  debian/rules:7: recipe for target 'override_dh_auto_test' failed

  You can reproduce this bug by creating a small Debian package, add
  pylint3 and python3-ruamel.yaml to its build dependencies and add this
  debian/rules snippet:

  override_dh_auto_test:
  	echo "import ruamel.yaml" > test.py
  	pylint3 --reports=no test.py

  Package versions:
  * pylint3 1.5.6-1
  * python3-astroid 1.4.8-1
  * python3.5 3.5.2-9

  Full list of packages is attached.

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/pylint/+bug/1651098/+subscriptions



More information about the foundations-bugs mailing list