[Biopython-dev] TravisCI BioSQL - TypeError: unhashable type: 'bytearray'

Peter Cock p.j.a.cock at googlemail.com
Fri Oct 10 09:34:02 UTC 2014

On Fri, Oct 10, 2014 at 1:22 AM, Evan Parker <eparker05 at gmail.com> wrote:
> 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.
> https://github.com/eparker05/biopython/commit/c6f0d17a37321b512818b8070b9e8a82bbc4493e
> 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.

That's good progress - it is enough to prepare a minimal test case
highlighting the change in mysql-connector-python which we could
report as a possible bug?

If this is deliberate, it would nice to isolate the hack to just this
database adapter via a new Adaptor class in BioSQL.DBUtils,
but that would mean a bit of re-factoring as so far all the data
retrieval is done via the standard cursor object.

(I am assuming, perhaps wrongly, that this is all working fine
under Python 3 for the other SQL backends already available
on Python 3. But which of them are we actually testing?)


More information about the Biopython-dev mailing list