Opened 5 years ago

Closed 4 years ago

Last modified 3 years ago

#11262 closed defect (worksforme)

Failed to install plugin on Trac 1.0.1 SLES 11 Python 2.6

Reported by: anonymous Owned by: Dirk Stöcker
Priority: normal Component: TracIniAdminPanelPlugin
Severity: normal Keywords:
Cc: Trac Release:

Description (last modified by Jun Omae)

python bdist_egg
cp dist/TracIniAdminPanel-1.0.1-py2.6.egg <trac>/plugins
cd  <trac>/plugins
-rw-r--r-- 1 wwwrun www 30749 Aug  7 15:53 TracIniAdminPanel-1.0.1-py2.6.egg

trac crashes afterwards with:

Traceback (most recent call last):

  File "build/bdist.linux-x86_64/egg/trac/web/", line 514, in send_error
    data, 'text/html')
  File "build/bdist.linux-x86_64/egg/trac/web/", line 975, in render_template
    template = self.load_template(filename, method=method)
  File "build/bdist.linux-x86_64/egg/trac/web/", line 933, in load_template
    self.get_all_templates_dirs(), auto_reload=self.auto_reload,
  File "build/bdist.linux-x86_64/egg/trac/web/", line 648, in get_all_templates_dirs
    for provider in self.template_providers:
  File "build/bdist.linux-x86_64/egg/trac/", line 78, in extensions
    components = [component.compmgr[cls] for cls in classes]
  File "build/bdist.linux-x86_64/egg/trac/", line 199, in __getitem__
    component = cls(self)
  File "build/bdist.linux-x86_64/egg/trac/", line 138, in __call__
  File "build/bdist.linux-x86_64/egg/inieditorpanel/", line 63, in __init__
    locale_dir = resource_filename(__name__, 'locale')
  File "build/bdist.linux-x86_64/egg/", line 945, in resource_filename
    self, resource_name
  File "build/bdist.linux-x86_64/egg/", line 1634, in get_resource_filename
    return self._extract_resource(manager, zip_path)
  File "build/bdist.linux-x86_64/egg/", line 1653, in _extract_resource
    timestamp, size = self._get_date_and_size(self.zipinfo[zip_path])
KeyError: 'inieditorpanel/locale'

Attachments (0)

Change History (4)

comment:1 Changed 5 years ago by Jun Omae

Description: modified (diff)

comment:2 Changed 5 years ago by anonymous

To build locale files, run:

$ python compile_catalog -f


$ python bdist_egg

comment:3 Changed 4 years ago by Dirk Stöcker

Resolution: worksforme
Status: newclosed

comment:4 Changed 3 years ago by Jun Omae

That issue occurs if Babel is not installed. Of course, Babel is optional.

We should handle such KeyError from resource_filename() when retrieving locale directory.

  • traciniadminpanelplugin/trunk/inieditorpanel/

    diff --git a/traciniadminpanelplugin/trunk/inieditorpanel/ b/traciniadminpanelplugin/trunk/inieditorpanel/
    index 1885cf4..0a1fc27 100644
    a b class TracIniAdminPanel(Component): 
    6262  def __init__(self):
    6363    """Set up translation domain"""
    64     locale_dir = resource_filename(__name__, 'locale')
    65     add_domain(self.env.path, locale_dir)
     64    try:
     65      locale_dir = resource_filename(__name__, 'locale')
     66    except KeyError:
     67      pass
     68    else:
     69      add_domain(self.env.path, locale_dir)
    6771    self.valid_section_name_chars_regexp = re.compile(self.valid_section_name_chars)
    6872    self.valid_option_name_chars_regexp = re.compile(self.valid_option_name_chars)

See also example for add_domain in trac:wiki:CookBook/PluginL10N#MakethePythoncodetranslation-aware.

Modify Ticket

Change Properties
Set your email in Preferences
as closed The owner will remain Dirk Stöcker.
The resolution will be deleted.

Add Comment

E-mail address and name can be saved in the Preferences.

Note: See TracTickets for help on using tickets.