Modify

Opened 11 years ago

Closed 11 years ago

Last modified 9 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 setup.py bdist_egg
cp dist/TracIniAdminPanel-1.0.1-py2.6.egg <trac>/plugins
cd  <trac>/plugins
ll
-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/api.py", line 514, in send_error
    data, 'text/html')
  File "build/bdist.linux-x86_64/egg/trac/web/chrome.py", line 975, in render_template
    template = self.load_template(filename, method=method)
  File "build/bdist.linux-x86_64/egg/trac/web/chrome.py", line 933, in load_template
    self.get_all_templates_dirs(), auto_reload=self.auto_reload,
  File "build/bdist.linux-x86_64/egg/trac/web/chrome.py", line 648, in get_all_templates_dirs
    for provider in self.template_providers:
  File "build/bdist.linux-x86_64/egg/trac/core.py", line 78, in extensions
    components = [component.compmgr[cls] for cls in classes]
  File "build/bdist.linux-x86_64/egg/trac/core.py", line 199, in __getitem__
    component = cls(self)
  File "build/bdist.linux-x86_64/egg/trac/core.py", line 138, in __call__
    self.__init__()
  File "build/bdist.linux-x86_64/egg/inieditorpanel/web_ui.py", line 63, in __init__
    locale_dir = resource_filename(__name__, 'locale')
  File "build/bdist.linux-x86_64/egg/pkg_resources.py", line 945, in resource_filename
    self, resource_name
  File "build/bdist.linux-x86_64/egg/pkg_resources.py", line 1634, in get_resource_filename
    return self._extract_resource(manager, zip_path)
  File "build/bdist.linux-x86_64/egg/pkg_resources.py", 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 11 years ago by Jun Omae

Description: modified (diff)

comment:2 Changed 11 years ago by anonymous

To build locale files, run:

$ python setup.py compile_catalog -f

before:

$ python setup.py bdist_egg

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

Resolution: worksforme
Status: newclosed

comment:4 Changed 9 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/web_ui.py

    diff --git a/traciniadminpanelplugin/trunk/inieditorpanel/web_ui.py b/traciniadminpanelplugin/trunk/inieditorpanel/web_ui.py
    index 1885cf4..0a1fc27 100644
    a b class TracIniAdminPanel(Component): 
    6161
    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)
    6670
    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
Action
as closed The owner will remain Dirk Stöcker.
The resolution will be deleted. Next status will be 'reopened'.

Add Comment


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

 
Note: See TracTickets for help on using tickets.