On Friday 23 December 2005 08:46, Zac Medico wrote:
> Jason Stubbs wrote:
> > On Thursday 22 December 2005 16:21, Brian Harring wrote:
> >>Not sure if hiding the exception away (traceback) is a good thing;
> >>wrapping it with purdy output, sure, but swallowing it?
> >
> > If it's failing to import, there's something pretty wrong with it. I'm
> > sure that module authors will know enough to remove the except block. Is
> > there really anything useful gained from dumping the traceback?
>
> A while back we had someone in #gentoo-portage with a problem where portage
> was swallowing the traceback in effectively the same way.  In that case it
> turned out to be a corrupt python bytecode file (.pyo) in their python
> installation.  Given that we can never rule out problems in the user's
> python installation (or third party python modules), the best policy may be
> to print a traceback in any case (better safe than sorry).

Ok, that's fair enough. I've generalized portage_util.dump_traceback() a bit 
and am making use of that. Sample error output would be along the lines of:

====================================
Error: Failed to import module 'cache.cdb.database'

  File "/usr/lib/portage/pym/portage.py", line 1285, in load_best_module
    mod = load_mod(best_mod)
  File "/usr/lib/portage/pym/portage.py", line 142, in load_mod
    mod = __import__(modname)
  File "/usr/lib/portage/pym/cache/cdb.py", line 6, in ?
    anksdjf
name 'anksdjf' is not defined
====================================

--
Jason Stubbs
-- 
[email protected] mailing list

Reply via email to