[issue26569] pyclbr.readmodule() and pyclbr.readmodule_ex() don't support packages

Eric Snow report at bugs.python.org
Wed Mar 16 19:05:51 EDT 2016


Eric Snow added the comment:

Hmm. These two should be equivalent:

  if spec.loader.is_package(fullmodule):
      dict['__path__'] = [os.path.dirname(fname)]

  if spec.submodule_search_locations is not None:
      dict['__path__'] = spec.submodule_search_locations

Do you mean that "python -m pyclbr XXX" doesn't work for packages?  I'm guessing you mean something else because I was able to run it successfully for both "os" (sort of a package) and "importlib".

Also, I noticed that if I run pyclbr on the "test" package or "test.regrtest" I get back no output, not an error.  I'd expect to get output though.  Perhaps that's related?

If you are getting an error, what is the traceback you are getting?

Note that pyclbr fails with the following if you try to run it on a file or module that doesn't exist:

  AttributeError: 'NoneType' object has no attribute 'loader'

----------
nosy: +eric.snow, ncoghlan

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue26569>
_______________________________________


More information about the Python-bugs-list mailing list