<div dir="ltr">I tried a few things today and came up with a fix. I can't speak to the efficiency of this fix but it does pass local tests and Travis-CI. I made a helper function to filter out bytearrays (and byte strings) and convert them to the Python version appropriate string type. I then applied this function to query methods in the Adaptor class of BioSQL/BioSeqDatabase.py. See the following commit.<div><br></div><div><a href="https://github.com/eparker05/biopython/commit/c6f0d17a37321b512818b8070b9e8a82bbc4493e">https://github.com/eparker05/biopython/commit/c6f0d17a37321b512818b8070b9e8a82bbc4493e</a></div><div><br></div><div>It would be nice if there was a more direct way to fix this, but the mysql database connector isn't documented all that well. My hope initially was to use the MySQL cursor to prevent the return of bytearrays in favor of a more typical string type, but I couldn't find any way to do this. If somebody figures that out, it would probably be a better fix.</div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Oct 9, 2014 at 4:18 PM, Chris Mitchell <span dir="ltr"><<a href="mailto:chris.mit7@gmail.com" target="_blank">chris.mit7@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><p dir="ltr">Also for a fix, i haven't tried this yet but my guess is the mysql-connector-python update is returning bytearrays (maybe a python3 move?). So we need to wrap the cursor for each result. Currently, we check if each element is of type bytes, which is an str but a bytearray is an array of ints. So we should be doing something like if isinstance(xxx[], (bytes, int)): xxx[0].decode('utf-8')</p>
<p dir="ltr">Sent from my phone.</p><span class="">
<div class="gmail_quote">On Oct 9, 2014 6:04 PM, "Peter Cock" <<a href="mailto:p.j.a.cock@googlemail.com" target="_blank">p.j.a.cock@googlemail.com</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On Thu, Oct 9, 2014 at 6:27 PM, Chris Mitchell <<a href="mailto:chris.mit7@gmail.com" target="_blank">chris.mit7@gmail.com</a>> wrote:<br>
> Have you tried specifying the working version of mysql-connector-python with<br>
> pip?<br>
><br>
> ie. pip install mysql-connector-python==xxx<br>
<br>
No, but that might be nicer in the short term than simply skipping<br>
installing and testing with mysql-connector-python on TravisCI.<br>
<br>
<a href="https://github.com/biopython/biopython/commit/4d54e46549df2a6cfc9815af38066ede1ce7f280" target="_blank">https://github.com/biopython/biopython/commit/4d54e46549df2a6cfc9815af38066ede1ce7f280</a><br>
<a href="https://github.com/biopython/biopython/issues/370" target="_blank">https://github.com/biopython/biopython/issues/370</a><br>
<br>
Anyone can fork Biopython, enable TravisCI on your fork, and<br>
then try modifying the .travis.yml file to test this... ;)<br>
<br>
Peter<br>
</blockquote></div>
</span></div>
<br>_______________________________________________<br>
Biopython-dev mailing list<br>
<a href="mailto:Biopython-dev@mailman.open-bio.org">Biopython-dev@mailman.open-bio.org</a><br>
<a href="http://mailman.open-bio.org/mailman/listinfo/biopython-dev" target="_blank">http://mailman.open-bio.org/mailman/listinfo/biopython-dev</a><br></blockquote></div><br></div>