Pydoc dies when trying to search keywords through packages with dependency problems. It seems the *real* problem is portage installing broken packages when USE flags are used to not install all dependencies of the python package. For example, biopython includes a module called Bio.GFF which requires mysql, but portage considers optional to include dependency on mysql-python. I suppose the question has been previously considered about whether this should be corrected on the python or on the portage side. But it certainly creates an usability problem with python on Gentoo. I think the obvious hack is just to make pydoc skip to the next package when it receives an exception on importing some module. Reproducible: Always Steps to Reproduce: 1.emerge biopython with USE flag "-mysql" (the bug requires mysql-python not to be emerged independently of biopython) 2.pydoc -k AnyThing Actual Results: Bio.MissingExternalDependencyError: Install MySQLdb if you want to use Bio.GFF.
Created attachment 226587 [details] Error messages when pydoc tries to search keywords through biopython module
Created attachment 226589 [details] Error messages obtained when pydoc tries to search keywords through pyopengl module
Bug report QA messages: * Please use full package qualifiers (e.g. "sys-apps/portage", not just "portage") in bug report titles, at the beginning ideally, in the future. Thank you!
(In reply to comment #3) > Bug report QA messages: > > * Please use full package qualifiers > (e.g. "sys-apps/portage", not just "portage") > in bug report titles, at the beginning ideally, > in the future. Thank you! > Yep, sorry. I'll remember that. Thank you!
I wonder if Biopython were to use a subclass of ImportError, rather than its own Bio.MissingExternalDependencyError this would help? e.g. http://github.com/peterjc/biopython/tree/import-exception
Still present in current versions. @python-team. Can you comment on that? e.g. for biopython forcing USE="mysql" should not be an option. On the other hand, breaking pydoc by installing biopython is not an option either.
(In reply to comment #5) > I wonder if Biopython were to use a subclass of ImportError, rather than > its own Bio.MissingExternalDependencyError this would help? e.g. > > http://github.com/peterjc/biopython/tree/import-exception > Looking at the code for pkgutil.py and function walk_packages in particular, it will cope with exceptions which are of class ImportError (or a subclass). In this case, both Biopython and pyopengl are (currently) not raising an ImportError, and this could be changed if appropriate. I've fixed this particular case (Bio.GFF) on the Biopython trunk and the change will be included as part of Biopython 1.56 due later this year: http://github.com/biopython/biopython/commit/cb1f54499c0273e1bd45a163781f8a0680e3fc6e However, I think this is a really bug in pydoc for not copying with an import failure where a non-ImportError is raised.
I agree with Peter, this seems to be a Pydoc upstream problem - even though all such errors should be ImportErrors, you can't rely on all packages conforming to this rule. (In reply to comment #7) > (In reply to comment #5) > > I wonder if Biopython were to use a subclass of ImportError, rather than > > its own Bio.MissingExternalDependencyError this would help? e.g. > > > > http://github.com/peterjc/biopython/tree/import-exception > > > > Looking at the code for pkgutil.py and function walk_packages in particular, > it will cope with exceptions which are of class ImportError (or a subclass). > > In this case, both Biopython and pyopengl are (currently) not raising an > ImportError, and this could be changed if appropriate. I've fixed this > particular case (Bio.GFF) on the Biopython trunk and the change will be > included as part of Biopython 1.56 due later this year: > > http://github.com/biopython/biopython/commit/cb1f54499c0273e1bd45a163781f8a0680e3fc6e > > However, I think this is a really bug in pydoc for not copying with an > import failure where a non-ImportError is raised. >
Fixed by this commit 23 Jun 2011; Markos Chandras <hwoarang@gentoo.org> -biopython-1.56.ebuild: Remove old ebuilds. Requested by Arfrever