Opened 8 years ago

Closed 8 years ago

#4412 closed defect (worksforme)

ZipImportError: bad local file header?

Reported by: Matt Callaghan Owned by: Martin Scharrer
Priority: normal Component: WatchlistPlugin
Severity: blocker Keywords:
Cc: Martin Scharrer Trac Release: 0.11


As per #4275 I was trying to test the fix provided by martin_s.

After running

sudo easy_install

Trac gives the following now when we view the "plugins" tab in the Admin page:

Trac detected an internal error:

ZipImportError: bad local file header in /usr/lib/python2.5/site-packages/TracWatchlistPlugin-0.1-py2.5.egg

Python Traceback

Most recent call last:

    * File "/usr/lib/python2.5/site-packages/Trac-", line 432, in _dispatch_request
      Code fragment:
       427. try:
       428. if not env and env_error:
       429. raise HTTPInternalError(env_error)
       430. try:
       431. dispatcher = RequestDispatcher(env)
       432. dispatcher.dispatch(req)
       433. except RequestDone:
       434. pass
       435. resp = req._response or []
       437. except HTTPException, e:
      Local variables:
      Name	Value
      after 	[u' except RequestDone:', u' pass', u' resp = ...
      before 	[u' try:', u' if not env and env_error:', u' raise ...
      dispatcher 	<trac.web.main.RequestDispatcher object at 0xb51f24c>
      e 	ZipImportError('bad local file header in ...
      env 	<trac.env.Environment object at 0xb12df4c>
      env_error 	None
      exc_info 	(<class 'zipimport.ZipImportError'>, ZipImportError('bad local file header ...
      filename 	'/usr/lib/python2.5/site-packages/Trac-' ...
      frames 	[{'function': '_dispatch_request', 'lines_before': [u' try:', u' ...
      has_admin 	True
      line 	u' dispatcher.dispatch(req)'
      lineno 	431
      message 	u'ZipImportError: bad local file header in ...
      req 	<Request "GET u'/admin/general/plugin'">
      resp 	[]
      tb 	<traceback object at 0xb63111c>
      tb_hide 	None
      traceback 	'Traceback (most recent call last):\n File ...
    * File "/usr/lib/python2.5/site-packages/Trac-", line 204, in dispatch
      Code fragment:
       199. req.args.get('__FORM_TOKEN') != req.form_token:
       200. raise HTTPBadRequest('Missing or invalid form token. '
       201. 'Do you have cookies enabled?')
       203. # Process the request and render the template
       204. resp = chosen_handler.process_request(req)
       205. if resp:
       206. if len(resp) == 2: # Clearsilver
       207. chrome.populate_hdf(req)
       208. template, content_type = \
       209. self._post_process_request(req, *resp)
      Local variables:
      Name	Value
      chosen_handler 	<trac.admin.web_ui.AdminModule object at 0xb51f6ac>
      chrome 	< object at 0xb648d8c>
      err 	(<class 'zipimport.ZipImportError'>, ZipImportError('bad local file header ...
      handler 	<trac.admin.web_ui.AdminModule object at 0xb51f6ac>
      req 	<Request "GET u'/admin/general/plugin'">
      self 	<trac.web.main.RequestDispatcher object at 0xb51f24c>
    * File "/usr/lib/python2.5/site-packages/Trac-", line 113, in process_request
      Code fragment:
       108. if not provider:
       109. raise HTTPNotFound(_('Unknown administration panel'))
       111. if hasattr(provider, 'render_admin_panel'):
       112. template, data = provider.render_admin_panel(req, cat_id, panel_id,
       113. path_info)
       115. else: # support for legacy WebAdmin panels
       116. data = {}
       117. cstmpl, ct = provider.process_admin_request(req, cat_id, panel_id,
       118. path_info)
      Local variables:
      Name	Value
      _panel_order 	<function _panel_order at 0xb690f7c>
      cat_id 	u'general'
      panel_id 	u'plugin'
      panels 	[('general', 'General', 'basics', 'Basic Settings'), ('general', ...
      path_info 	None
      provider 	<trac.admin.web_ui.PluginAdminPanel object at 0xb6aeccc>
      providers 	{('tracini', 'inherit'): <iniadmin.iniadmin.IniAdminPlugin object at ...
      req 	<Request "GET u'/admin/general/plugin'">
      self 	<trac.admin.web_ui.AdminModule object at 0xb51f6ac>
    * File "/usr/lib/python2.5/site-packages/Trac-", line 400, in render_admin_panel
      Code fragment:
       395. anchor = ''
       396. if req.args.has_key('plugin'):
       397. anchor = '#no%d' % (int(req.args.get('plugin')) + 1)
       398. req.redirect(req.href.admin(cat, page) + anchor)
       400. return self._render_view(req)
       402. # Internal methods
       404. def _do_install(self, req):
       405. """Install a plugin."""
      Local variables:
      Name	Value
      cat 	u'general'
      page 	u'plugin'
      path_info 	None
      req 	<Request "GET u'/admin/general/plugin'">
      self 	<trac.admin.web_ui.PluginAdminPanel object at 0xb6aeccc>
    * File "/usr/lib/python2.5/site-packages/Trac-", line 504, in _render_view
      Code fragment:
       499. readonly = True
       500. if plugin_filename and os.access(dist.location,
       501. os.F_OK + os.W_OK):
       502. readonly = False
       503. # retrieve plugin metadata
       504. info = get_pkginfo(dist)
       505. if not info:
       506. info = {'summary': description}
       507. for k in ('author author_email home_page url license trac'
       508. .split()):
       509. v = getattr(module, k, '')
      Local variables:
      Name	Value
      ComponentMeta 	<class 'trac.core.ComponentMeta'>
      component 	<class 'tracwatchlist.db.WatchlistDB'>
      description 	u'DB handler class for Trac WatchlistPlugin.'
      dist 	TracWatchlistPlugin 0.1 ...
      info 	{'description': 'UNKNOWN', 'license': 'GPLv2+', 'author': 'Bernhard ...
      k 	'trac'
      module 	<module 'tracwatchlist.db' from ...
      plugin_filename 	None
      plugins 	{'BreadCrumbsNavPlugin': {'info': {'description': 'UNKNOWN', 'license': ...
      plugins_dir 	'/srv/trac/plugins'
      readonly 	True
      req 	<Request "GET u'/admin/general/plugin'">
      self 	<trac.admin.web_ui.PluginAdminPanel object at 0xb6aeccc>
      v 	''
      version 	''
    * File "/usr/lib/python2.5/site-packages/Trac-", line 241, in get_pkginfo
      Code fragment:
       236. 'description', 'version')
       237. info = {}
       238. def normalize(attr):
       239. return attr.lower().replace('-', '_')
       240. try:
       241. pkginfo = email.message_from_string(dist.get_metadata('PKG-INFO'))
       242. for attr in [key for key in attrs if key in pkginfo]:
       243. info[normalize(attr)] = pkginfo[attr]
       244. except IOError, e:
       245. err = 'Failed to read PKG-INFO file for %s: %s' % (dist, e)
       246. for attr in attrs:
      Local variables:
      Name	Value
      attrs 	('author', 'author-email', 'license', 'home-page', 'summary', ...
      dist 	TracWatchlistPlugin 0.1 ...
      email 	<module 'email' from '/usr/lib/python2.5/email/__init__.pyc'>
      info 	{}
      normalize 	<function normalize at 0xb69072c>
      types 	<module 'types' from '/usr/lib/python2.5/types.pyc'>
    * File "/usr/lib/python2.5/site-packages/", line 1137, in get_metadata
      Code fragment:
      1132. return self.egg_info and self._has(self._fn(self.egg_info,name))
      1134. def get_metadata(self, name):
      1135. if not self.egg_info:
      1136. return ""
      1137. return self._get(self._fn(self.egg_info,name))
      1139. def get_metadata_lines(self, name):
      1140. return yield_lines(self.get_metadata(name))
      1142. def resource_isdir(self,resource_name):
      Local variables:
      Name	Value
      name 	'PKG-INFO'
      self 	<pkg_resources.EggMetadata instance at 0xb6c25ac>
    * File "/usr/lib/python2.5/site-packages/", line 1195, in _get
      Code fragment:
      1190. def _fn(self, base, resource_name):
      1191. return os.path.join(base, *resource_name.split('/'))
      1193. def _get(self, path):
      1194. if hasattr(self.loader, 'get_data'):
      1195. return self.loader.get_data(path)
      1196. raise NotImplementedError(
      1197. "Can't perform this operation for loaders without 'get_data()'"
      1198. )
      1200. register_loader_type(object, NullProvider)
      Local variables:
      Name	Value
      path 	'/usr/lib/python2.5/site-packages/TracWatchlistPlugin-0.1-py2.5.egg/EGG-INF ...
      self 	<pkg_resources.EggMetadata instance at 0xb6c25ac>

File "/usr/lib/python2.5/site-packages/Trac-", line 432, in _dispatch_request
File "/usr/lib/python2.5/site-packages/Trac-", line 204, in dispatch
  resp = chosen_handler.process_request(req)
File "/usr/lib/python2.5/site-packages/Trac-", line 113, in process_request
File "/usr/lib/python2.5/site-packages/Trac-", line 400, in render_admin_panel
  return self._render_view(req)
File "/usr/lib/python2.5/site-packages/Trac-", line 504, in _render_view
  info = get_pkginfo(dist)
File "/usr/lib/python2.5/site-packages/Trac-", line 241, in get_pkginfo
  pkginfo = email.message_from_string(dist.get_metadata('PKG-INFO'))
File "/usr/lib/python2.5/site-packages/", line 1137, in get_metadata
  return self._get(self._fn(self.egg_info,name))
File "/usr/lib/python2.5/site-packages/", line 1195, in _get
  return self.loader.get_data(path)

Trac: Python: 2.5.2 (r252:60911, Jul 31 2008, 17:44:49) [GCC 4.2.3 (Ubuntu 4.2.3-2ubuntu7)] setuptools: 0.6c8 SQLite: 3.4.2 pysqlite: 2.3.2 Genshi: 0.6dev-r960 Subversion: 1.4.6 (r28521)

Attachments (0)

Change History (2)

comment:1 Changed 8 years ago by Martin Scharrer

Status: newassigned

This works for me. Sounds more like a local installation issue. Please check if the EGG file is a valid ZIP file, e.g. using:

unzip -t /usr/lib/python2.5/site-packages/TracWatchlistPlugin-0.1-py2.5.egg

Also you can try removing the EGG file and run the easy_install command again. Please post the output of it if the error occurs again.

comment:2 Changed 8 years ago by Martin Scharrer

Resolution: worksforme
Status: assignedclosed

No new feedback after two weeks. I'm closing this defect as 'worksforme'. Feel free to reopen it when you are able to provide feedback.

Modify Ticket

as closed The owner will remain Martin Scharrer.
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.