Hi,
I'm writing an script inside my TG2 app which I want to run in the
terminal and I'm not able to access the ugettext or lazy_ugettext
functions.

from pylons.i18n import ugettext as _, lazy_ugettext as l_

I'm getting this error

TypeError: No object (name: translator) has been registered for this
thread

The script looks like this:

import os
from argparse import ArgumentParser
from paste.deploy import appconfig
from sapns.config.environment import load_environment
from sapns.lib.sapns.util import update_metadata

def load_config(filename):
    conf = appconfig('config:' + os.path.abspath(filename))
    load_environment(conf.global_conf, conf.local_conf)

def parse_args():
    parser = ArgumentParser(description=__doc__)
    parser.add_argument('conf_file', help='configuration to use')

    return parser.parse_args()

def do_init():
    args = parse_args()
    load_config(args.conf_file)

    update_metadata()

if __name__ == '__main__':
    do_init()

and sapns.lib.sapns.util module starts with:

from pylons.i18n import ugettext as _, lazy_ugettext as l_

which causes the error

León Domingo

-- 
You received this message because you are subscribed to the Google Groups 
"TurboGears" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/turbogears?hl=en.

Reply via email to