[Biopython-dev] test_PhyloXML.py error on Python 2.4

Eric Talevich eric.talevich at gmail.com
Fri Apr 9 06:09:14 UTC 2010


On Thu, Apr 8, 2010 at 9:23 AM, Peter <biopython at maubp.freeserve.co.uk>wrote:

> On Thu, Apr 8, 2010 at 2:05 PM, Eric Talevich <eric.talevich at gmail.com>
> wrote:
> > On Thu, Apr 8, 2010 at 6:55 AM, Peter <biopython at maubp.freeserve.co.uk>
> > wrote:
> >>
> >> Hi Eric,
> >>
> >> I noticed that test_PhyloXML.py is failing on Python 2.4, it should
> >> be skipped since I don't have ElementTree installed. Have you got
> >> access to a Python 2.4 installation to look at this?
> >
> > The traceback says the PhyloXML module is missing, but PhyloXMLIO and the
> > rest of Bio.Phylo are there. Is that normal? I would expect that PhyloXML
> > would still be installed with Biopython on Py2.4, but when the test runs
> it
> > would trigger a MissingExternalDependency error for ElementTree when
> > importing PhyloXMLIO, and run_tests.py would then skip it.
>
> Yes, and I don't understand why that doesn't happen in the test suite:
>
> C:\>c:\python24\python
> Python 2.4.4 (#71, Oct 18 2006, 08:34:43) [MSC v.1310 32 bit (Intel)] on
> win32
> Type "help", "copyright", "credits" or "license" for more information.
> >>> from Bio.Phylo import PhyloXML as PX
> Traceback (most recent call last):
>   File "<stdin>", line 1, in ?
>  File "c:\python24\lib\site-packages\Bio\Phylo\__init__.py", line 12, in ?
>     from Bio.Phylo._io import parse, read, write, convert
>   File "c:\python24\Lib\site-packages\Bio\Phylo\_io.py", line 15, in ?
>    import PhyloXMLIO
>  File "c:\python24\Lib\site-packages\Bio\Phylo\PhyloXMLIO.py", line 42, in
> ?
>    raise MissingExternalDependencyError(
> Bio.MissingExternalDependencyError: No ElementTree module was found. Use
> Python
> 2.5+, lxml or elementtree if you want to use Bio.PhyloXML.
> >>>
>
> Odd.
>
> Peter
>


Well, it's fixed in GitHub now:
http://github.com/biopython/biopython/commit/7bd18aaf9582dd7d9193cc39d7faf6d51e3e4161

It seems like imports are being cached in some way so that an import that
failed once is not tried again. In any case, it still raises an ImportError
which we can catch and turn into another MissingExternalDependencyError.

-Eric



More information about the Biopython-dev mailing list