Modify

Opened 2 years ago

Closed 14 months ago

#14163 closed defect (fixed)

KeyError: 'tracpdf/htdocs' raised

Reported by: Jun Omae Owned by: Cinc-th
Priority: normal Component: TracWikiPrintPlugin
Severity: normal Keywords:
Cc: Trac Release: 1.4

Description

This plugin uses tracpdf/htdocs resource and a css file in the htdocs directory, however the css file is not installed. As the result, the following exception is raised:

Traceback (most recent call last):
 File "/usr/lib/python3.10/site-packages/Trac-1.5.4.dev0-py3.10.egg/trac/web/main.py", line 610, in dispatch_request
   dispatcher.dispatch(req)
 File "/usr/lib/python3.10/site-packages/Trac-1.5.4.dev0-py3.10.egg/trac/web/main.py", line 302, in dispatch
   raise e
 File "/usr/lib/python3.10/site-packages/Trac-1.5.4.dev0-py3.10.egg/trac/web/main.py", line 248, in dispatch
   resp = chosen_handler.process_request(req)
 File "/usr/lib/python3.10/site-packages/Trac-1.5.4.dev0-py3.10.egg/trac/web/chrome.py", line 718, in process_request
   in provider.get_htdocs_dirs() or []
 File "/usr/lib/python3.10/site-packages/TracWikiPrint-4.0.0.dev0-py3.10.egg/tracpdf/admin.py", line 153, in get_htdocs_dirs
   return [('wikiprint', resource_filename(__name__, 'htdocs'))]
 File "/usr/lib/python3.10/site-packages/pkg_resources/__init__.py", line 1154, in resource_filename
   return get_provider(package_or_requirement).get_resource_filename(
 File "/usr/lib/python3.10/site-packages/pkg_resources/__init__.py", line 1763, in get_resource_filename
   return self._extract_resource(manager, zip_path)
 File "/usr/lib/python3.10/site-packages/pkg_resources/__init__.py", line 1785, in _extract_resource
   timestamp, size = self._get_date_and_size(self.zipinfo[zip_path])
KeyError: 'tracpdf/htdocs'
$ python setup.py bdist_egg
$ unzip -l dist/*.egg
Archive:  dist/TracWikiPrint-4.0.0.dev0-py2.7.egg
  Length      Date    Time    Name
---------  ---------- -----   ----
     7649  2022-10-20 11:17   EGG-INFO/PKG-INFO
      480  2022-10-20 11:17   EGG-INFO/SOURCES.txt
        1  2022-10-20 11:17   EGG-INFO/dependency_links.txt
      118  2022-10-20 11:17   EGG-INFO/entry_points.txt
       12  2022-10-20 11:17   EGG-INFO/requires.txt
        8  2022-10-20 11:17   EGG-INFO/top_level.txt
        1  2022-10-20 11:17   EGG-INFO/zip-safe
     1606  2022-10-18 20:19   tracpdf/__init__.py
      334  2022-10-20 11:17   tracpdf/__init__.pyc
     7470  2022-10-18 20:19   tracpdf/admin.py
     5967  2022-10-20 11:17   tracpdf/admin.pyc
     4791  2022-10-18 20:19   tracpdf/pdfbook.py
     3893  2022-10-20 11:17   tracpdf/pdfbook.pyc
     2626  2022-10-18 20:19   tracpdf/util.py
     1589  2022-10-20 11:17   tracpdf/util.pyc
    16552  2022-10-20 11:17   tracpdf/wikiprint.py
    12949  2022-10-20 11:17   tracpdf/wikiprint.pyc
     3438  2022-10-18 20:19   tracpdf/templates/wikiprint_admin_parameters.html
     4852  2022-10-18 20:19   tracpdf/templates/wikiprint_parameters.html
---------                     -------
    74336                     19 files

Fix for the issue:

  • setup.py

     
    3333    version='4.0.0',
    3434    packages=['tracpdf'],
    3535    package_data={
    36         'tracpdf': ['templates/*.html'
    37         ]
     36        'tracpdf': ['templates/*.html', 'htdocs/css/*.css'],
    3837    },
    3938    install_requires=['pdfkit', 'trac'],
    4039    author='Cinc-th',

Attachments (0)

Change History (1)

comment:1 Changed 14 months ago by Ryan J Ollos

Resolution: fixed
Status: newclosed

In 18574:

TracWikiPrintPlugin 4.0.0dev: Add CSS to package

Patch by Jun Omae.

Fixes #14163.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Cinc-th.
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.