[Biopython] Bio.Entrez.epost error with Python 3.2

Nicolas Joannin nicolas.joannin at gmail.com
Thu Mar 21 08:30:46 UTC 2013


Hi everyone,

I am still in need of a fix for this problem...
I have made an attempt at fixing it myself by adding a line of code in
Bio.Entrez.__init__.py:

At line 451 there is:

    try:
        if post:
            #HTTP POST
*            options = options.encode('utf-8') **#Line added by Nicolas*
            handle = urllib.request.urlopen(cgi, data=options)
        else:
            #HTTP GET
            cgi += "?" + options
            handle = urllib.request.urlopen(cgi)
    except urllib.error.HTTPError as exception:
        raise exception

In my (limited) testing, it seems to work...
Would this be suitable?

Best regards,
Nicolas





"Because the world owes me nothing, and we owe each other the world"
Ani Difranco


On Mon, Jan 28, 2013 at 4:04 AM, Peter Cock <p.j.a.cock at googlemail.com>wrote:

> On Sun, Jan 27, 2013 at 4:41 AM, Michiel de Hoon <mjldehoon at yahoo.com>
> wrote:
> > Looking at this some more, I found this on the mailing list explaining
> why we are using post=True:
> >
> > http://lists.open-bio.org/pipermail/biopython/2009-May/005152.html
>
> Yes, we use post (as the name epost suggests) to upload a long list
> of IDs without the long URL limitations faced if using an HTTP get.
>
> > This page provides some explanation on urllib.parse.urlencode in Python3:
> >
> > http://docs.python.org/3/library/urllib.request.html#urllib-examples
> >
>
> Does this mean we have a subtle Python 2 vs 3 problem with
> epost?
>
> Time for another unit test in test_Entrez_online.py which
> currently only tests einfo and efetch - we should have
> esearch, epost, espell and esummary in there too I think.
>
> Peter
>



More information about the Biopython mailing list