[Biopython-dev] test_Entrez 3.x
Peter
biopython at maubp.freeserve.co.uk
Mon Jul 5 14:38:05 UTC 2010
2010/7/5 Tiago Antão <tiagoantao at gmail.com>:
> Hi,
>
> A pre-read,
> http://dbaktiar.wordpress.com/2009/08/20/python-3-1-file-open-is-no-longer-binary-by-default/
> I am not completely sure that the text above is totally correct, but
> it does introduce the problem quite well.
>
> expat seems to want a byte stream.
> In the core code this is minor, Expat.Parser gets one open(,"rb") on
> externalEntityRefHandler and it is ready to roll (at least passes the
> test_Entrez test).
> But test_Entrez does need quite a few files open as rb.
>
> I do not know if I like this idea of opening a text file as binary.
> But at least the core code is barely touched. It is more an issue with
> the test.
If Expat wants bytes, then on Python 3 we need to open the file in binary mode.
This should be harmless on Python 2, although we should confirm this by
running the unit tests on Windows - the only difference I would expect this
will disable the magic new line conversion.
Peter
More information about the Biopython-dev
mailing list