[Mailman-Users] mailman NameError: global name '_' is not defined

Mark Sapiro mark at msapiro.net
Wed Jun 8 04:53:46 CEST 2011


On 6/7/2011 6:35 PM, Steven Jones wrote:
> hi,
> 
> Oops sorry think i copied the wrong one!


OK. See comments inline.


[...]
> import sys
> import getpass
> import getopt
> 
> import paths
> from Mailman import Utils
> from Mailman.i18n import C_


It appears that Red Hat has implemented a  Mailman.i18n.C_ function that
is not in standard GNU Mailman and are using it here instead of the
standard Mailman.i18n._ function.

I can guess that C_ is intended to be 'command _', i.e. a replacement
for the standard i18n._() to be used in command line programs, but that
is only a guess, and I have no idea why they would do this.


> PROGRAM = sys.argv[0]
> ^L
> def usage(code, msg=''):
>     if code:
>         fd = sys.stderr
>     else:
>         fd = sys.stdout
>     print >> fd, _(__doc__)


However, in changing the references from _() to C_(), the line above was
overlooked. You can fix your issue by changing the single line above from

    print >> fd, _(__doc__)

to

    print >> fd, C_(__doc__)

-- 
Mark Sapiro <mark at msapiro.net>        The highway is for gamblers,
San Francisco Bay Area, California    better use your sense - B. Dylan



More information about the Mailman-Users mailing list