[Biopython-dev] CDAO problems on Windows, was: Compiling Biopython on 64 bit Windows
Peter Cock
p.j.a.cock at googlemail.com
Tue Apr 22 09:08:40 EDT 2014
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.
>> #################################################
>>
>>
>> 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.
Peter
More information about the Biopython-dev
mailing list