[Biopython-dev] CDAO problems on Windows, was: Compiling Biopython on 64 bit Windows

Peter Cock p.j.a.cock at googlemail.com
Fri May 2 15:14:42 UTC 2014


On Tue, Apr 22, 2014 at 2:08 PM, Peter Cock <p.j.a.cock at googlemail.com> wrote:
> On Tue, Apr 22, 2014 at 10:57 AM, Peter Cock <p.j.a.cock at googlemail.com> wrote:
>> On Mon, Apr 21, 2014 at 10:51 PM, Manlio Calvi <manlio.calvi at gmail.com> wrote:
>>> ...
>>>
>>> ======================================================================
>>> ERROR: test_write_0 (test_Phylo_CDAO.WriterTests)
>>> Write and re-parse the phylogenies in test.cdao.
>>> ----------------------------------------------------------------------
>>> Traceback (most recent call last):
>>>   File ".\test_Phylo_CDAO.py", line 62, in test_write
>>>     CDAOIO.write([t1], outfile)
>>>   File "C:\Users\CasuallyChaotic\Desktop\3.3 - Biopython
>>> test\WinPython-64bit-3.3.3.3\python-3.3.3.amd64\biopython\Bio\Phylo\CDAOIO.py",
>>> line 74, in write
>>>     return Writer(trees).write(handle, plain=plain, **kwargs)
>>>   File "C:\Users\CasuallyChaotic\Desktop\3.3 - Biopython
>>> test\WinPython-64bit-3.3.3.3\python-3.3.3.amd64\biopython\Bio\Phylo\CDAOIO.py",
>>> line 268, in write
>>>     handle.write('@prefix %s: <%s> .\n' % (k, v))
>>> TypeError: 'str' does not support the buffer interface
>>>
>>
>> That looks like a string versus bytes issue with the handle
>> (text versus binary mode), but I don't recall any changes
>> in that code... maybe a question for Eric?
>
> I've not looked into this issue yet, however the reason the
> existing Windows buildbot never reported this is that I have
> not installed RDFlib on it (not even for Python 2.6 and 2.7).
>
> That was an oversight - and part of the reason to try and
> get more buildslaves - diversity.

This is also happening on Linux with Python 3.4, e.g. this
run from one of Tiago's docker setups:
http://testing.open-bio.org/biopython/builders/Linux%2064%20-%20Python%203.4/builds/19

======================================================================
ERROR: test_write_0 (test_Phylo_CDAO.WriterTests)
Write and re-parse the phylogenies in test.cdao.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/biopython/lin3464/build/Tests/test_Phylo_CDAO.py", line 62,
in test_write
    CDAOIO.write([t1], outfile)
  File "/biopython/lin3464/build/build/lib.linux-x86_64-3.4/Bio/Phylo/CDAOIO.py",
line 74, in write
    return Writer(trees).write(handle, plain=plain, **kwargs)
  File "/biopython/lin3464/build/build/lib.linux-x86_64-3.4/Bio/Phylo/CDAOIO.py",
line 268, in write
    handle.write('@prefix %s: <%s> .\n' % (k, v))
TypeError: 'str' does not support the buffer interface

----------------------------------------------------------------------

I would guess it is a unicode vs bytes string problem, but the
good news is that it is not Windows specific. I've logged and issue:
https://github.com/biopython/biopython/issues/319

>>> #################################################
>>>
>>>
>>> The test output for CDAO reports a series of slightly messages (more
>>> than an hundred) that looks like this:
>>> file://C:\WinPython3.3\3.3 - Biopython
>>> test\WinPython-64bit-3.3.3.3\python-3.3.3.amd64\biopython\Tests\CDAO\test.cdao/tree0000001#node0000001
>>> does not look like a valid URI, trying to serialize this will break.
>>
>> My hunch is this warning could be due to the mixed slashes
>> (forward and back) which is typically fine with the windows
>> API for filenames, but evidently is confusing the CDAO
>> code - a question for Ben?
>
> According to the RDFLib docstring for their URI class, yes, they
> issue this warning if the URI contains a Windows-style forward slash:
>
> http://rdflib.readthedocs.org/en/latest/_modules/rdflib/term.html
>
> The relevant snippet of their code is:
>
> _invalid_uri_chars = '<>" {}|\\^`'
>
> def _is_valid_uri(uri):
>     for c in _invalid_uri_chars:
>         if c in uri: return False
>     return True
>
> My suggestion would be to switch all the "\" into "/" here.

Again, issue filed:
https://github.com/biopython/biopython/issues/320

Peter



More information about the Biopython-dev mailing list