[BioPython] Loading SwissProt to BioSQL

Peter biopython at maubp.freeserve.co.uk
Wed Oct 24 21:15:10 UTC 2007


Jonathan Boulais wrote:
> Hello,
> 
> I'm a biologist and quite newb with Biopython. I'm trying to build 
> locally the Swissprot database with BioSQL and I'm having some 
> problems. I have installed the latest version from the CVS and I'm 
> using python 2.5 on a Mac Os 10.4.
> 
> First, i get this weird problem. Since I need to connect with MySQL I
>  started to wrote a simple script (Biosql.py) with only this ( from 
> BioSQL import BioSeqDatabase). When I run this script in the
> terminal: python Biosql.py, I get this message **ImportError: cannot
> import name BioSeqDatabase**. But the weird thing is if I start a
> python session in the terminal by simply invoking python and then
> manually import BioSeqDatabase, it's working ! Is there any reason
> for that ?

In both cases are you running python from the command prompt?  If so 
then the same environment variables (e.g. paths) should apply.  Odd.

My guess is you shouldn't call your script "Biosql.py", call it 
"Biosql_test.py" or something.  Python thinks the line "from BioSQL 
import BioSeqDatabase" means importing from the script itself because 
that is also called BioSQL.

Peter




More information about the Biopython mailing list