[BioPython] Re : from Bio import db

Eric Gibert ericgibert at yahoo.fr
Thu Nov 8 12:36:46 UTC 2007


Dear Peter,

Yes, this fix the error, *thank you*. 

NB: line is 1283, not 1293 (little typo error but maybe important for future refernece, I do not know).

Then I have subsequent errors, unrelated to the current topic [which is fixed]. Let me first investigate before sending another mail, on another topic/bug report.

Eric


----- Message d'origine ----
De : Peter <biopython at maubp.freeserve.co.uk>
À : Michiel De Hoon <mdehoon at c2b2.columbia.edu>
Cc : Eric Gibert <ericgibert at yahoo.fr>; biopython at lists.open-bio.org
Envoyé le : Jeudi, 8 Novembre 2007, 20h14mn 18s
Objet : Re: [BioPython] from Bio import db

>> ImportError: cannot import name db
> 
> It looks like we missed an "import db" statement in
 Bio/GenBank/__init__.py.
> Can you show us the code leading up to this point? I'm guessing that
 you are
> trying to use NCBIDictionary, but it would be helpful to see how
 exactly you
> are trying to use it, so that we can come up with a solution.
> 
> Sorry for the trouble.

I think the problem was introduced in Biopython 1.44 by disabling some 
"magic" code in Bio/__init__.py which created Bio.db at runtime, which 
was then imported in Bio/GenBank/__init__.py

The following one line patch to the NCBIDictionary class in 
Bio/GenBank/__init__.py seems to fix this:

diff -r1.77 __init__.py
1283c1283
<         from Bio import db
---
 >         from Bio.config.DBRegistry import db

i.e. change line 1293 from "from Bio import db" to "from 
Bio.config.DBRegistry import db" in the NCBIDictionary class.

Eric, could you try this on your setup?

Peter

Note to self: We need to add the NCBIDictionary to the GenBank unit
 test







      _____________________________________________________________________________ 
Ne gardez plus qu'une seule adresse mail ! Copiez vos mails vers Yahoo! Mail 



More information about the Biopython mailing list