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

Bug #1651098 reported by Benjamin Drung
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
pylint (Ubuntu)
Confirmed
Undecided
Unassigned

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.

Revision history for this message
Benjamin Drung (bdrung) wrote :
Revision history for this message
Benjamin Drung (bdrung) wrote :
Revision history for this message
Benjamin Drung (bdrung) wrote :

Also note that pylint3 works fine on Debian testing and Ubuntu 16.10 (yakkety).

nixargh (nixargh)
Changed in pylint (Ubuntu):
status: New → Confirmed
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.