[Biopython] Bad Gateway IOerror when querying Entrez

Peter Cock p.j.a.cock at googlemail.com
Sat Feb 5 21:48:38 UTC 2011


On Sat, Feb 5, 2011 at 7:10 PM, Brett Bowman <bnbowman at gmail.com> wrote:
> I'm running a script that takes a multi-fasta file and runs a local
> PSI-Blast on each seq, then queries NCBI for the full record of each one of
> those hits.  It works fine most of the time, but occasionally it throws an
> IOError telling me that there is a "Bad Gateway".  Curiously, this causes
> the script to crash sometimes but not others, and sometimes it gives me a
> warning of a "J" in the sequence when there are no Js in any of my files,
> except in the Fasta header.
>
> Does anyone know what causes this or how to stop it?  Or do I just need to
> trap IO exceptions from every web query that I run, with appropriate code to
> retry failed queries?
>
> Brett Bowman

Hi Brett,

I've never had this 'J' problem (is this for PSI-BLAST?)... not sure what
is going on there.

However, a "Bad Gateway" or other IOErrors are almost to be expected
with a long Entrez script (especially if run during peak times - don't forget
to check the NCBI usage guidelines). I recommend you add a try/except
block and some sensible retry code.

Peter




More information about the Biopython mailing list