[Biopython-dev] Python 3 and encoding for online resources

Michiel de Hoon mjldehoon at yahoo.com
Wed Aug 4 09:29:04 EDT 2010


--- On Wed, 8/4/10, Peter <biopython at maubp.freeserve.co.uk> wrote:
> > In the cases I've tried, the metadata revealed that an
> error had occurred,
> > even if urllib2.urlopen didn't raise an HTTP error but
> returned a handle to
> > XML containing the error message.
> 
> What meta data?
> 
I was looking at handle.info(), where handle is the handle returned by urllib2.urlopen. But in your example, the information in handle.info() did not reveal a difference between a successful search and an unsuccessful one, so anyway this won't work in general.

Btw, this is an error message nowadays returned by epost:

>>> handle = Entrez.epost(db="nothing")
>>> handle.read()
'\n\n<ePostResult>\n\t<ERROR>Invalid db name specified: nothing</ERROR>\n</ePostResult>\n'
>>> 

Previously, the same request gave a clean error message in XML format (see epost2.xml in Tests/Entrez).

--Michiel.


      


More information about the Biopython-dev mailing list