Look like there is a problem with pup/pirut and the aliases plugin.

https://www.redhat.com/archives/fedora-test-list/2008-January/msg00154.html

I have answered the user to open a bz report the problem.

The problem is the
from i18n import _

this only works when running from the cli, bacause i18n.py is located in /usr/share/yum-cli and nor available without adding '/usr/share/yum-cli'
the python path.
yumex works because it have a i18n.py providing the same function.

a quick workaround could be adding:

try:
    from i18n import _
except ImportError:
    def _(msg):
        print msg
or

import sys
sys.path.insert(0,'/usr/share/yum-cli')

A hole other problem is why adding _() to the plugin, it will not work because the messages will not be picked up by the yum.pot file because the plugin is not part of the yum main packages and then not part of the yum translation domain.

So the best solution for now is to remove the _() calls and just do normal printing or even better write to the yum.verbose_log instead.

This error raises another issues, is it a good idea to use the yum-cli classes from a plugin, in a util it make sense because the what to avoid
duplication of code.
If there is some functionality in the cli code there is needed by plugins, then it should be move to a public module yum or maybe a new yum-cli one.

Tim
_______________________________________________
Yum-devel mailing list
[email protected]
https://lists.dulug.duke.edu/mailman/listinfo/yum-devel

Reply via email to