#296 module import error message masks missing modules
Closed: Fixed None Opened 8 years ago by kparal.

We now have libtaskotron ext modules and detect whether they are installed, which is great. The problem is that the error message claims I don't have it installed:

$ runtask -i htop-1.0.3-4.fc21 -t koji_build ../task-rpmlint/rpmlint.yml 
Traceback (most recent call last):
  File "/home/kparal/devel/taskotron/env_taskotron/bin/runtask", line 9, in <module>
    load_entry_point('libtaskotron==0.4.4', 'console_scripts', 'runtask')()
  File "/home/kparal/devel/taskotron/env_taskotron/lib/python2.7/site-packages/pkg_resources.py", line 356, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/home/kparal/devel/taskotron/env_taskotron/lib/python2.7/site-packages/pkg_resources.py", line 2431, in load_entry_point
    return ep.load()
  File "/home/kparal/devel/taskotron/env_taskotron/lib/python2.7/site-packages/pkg_resources.py", line 2147, in load
    ['__name__'])
  File "/home/kparal/devel/taskotron/libtaskotron/libtaskotron/main.py", line 17, in <module>
    from libtaskotron.overlord import Overlord
  File "/home/kparal/devel/taskotron/libtaskotron/libtaskotron/overlord.py", line 10, in <module>
    from libtaskotron import executor
  File "/home/kparal/devel/taskotron/libtaskotron/libtaskotron/executor.py", line 25, in <module>
    raise exc.TaskotronImportError("Executor requires libtaskotron.ext.fedora.rpm_utils but "
libtaskotron.exceptions.TaskotronImportError: Executor requires libtaskotron.ext.fedora.rpm_utils but it could not be imported. Make sure that libtaskotron-fedora is installed

while in fact, I do. But I can't import it because I'm missing a different library:

In [2]: import libtaskotron.ext.fedora.rpm_utils
---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
<ipython-input-2-74c2a8bfb820> in <module>()
----> 1 import libtaskotron.ext.fedora.rpm_utils

/home/kparal/devel/taskotron/libtaskotron/libtaskotron/ext/fedora/rpm_utils.py in <module>()
      8 from __future__ import absolute_import
      9 import re
---> 10 import hawkey
     11 import subprocess
     12 import pipes

ImportError: No module named hawkey

So, I was missing python-hawkey, but the error message complete hid that problem. That can be quite hard to debug. What can we do to improve this? At least we could print out the original import error as well, that would give good pointers to what's missing. Ideally, we also shouldn't claim the module is not there when it is, but I wonder whether we can detect that easily?


This ticket had assigned some Differential requests:
D659

must...resist....urge....to...say....stufff......

I'd say do what @jskladan mentioned in D616 - remove the throwing of a new error and just raise the original ImportError

Metadata Update from @kparal:
- Issue tagged with: easyfix

6 years ago

Login to comment on this ticket.

Metadata