[Biopython-dev] [Bug 2390] Error importing Swiss Prot in BioSQL

bugzilla-daemon at portal.open-bio.org bugzilla-daemon at portal.open-bio.org
Thu Nov 1 05:14:43 EDT 2007


http://bugzilla.open-bio.org/show_bug.cgi?id=2390





------- Comment #6 from biopython-bugzilla at maubp.freeserve.co.uk  2007-11-01 05:14 EST -------
We may have two bugs here.

First of all your original problem, TypeError: not all arguments converted
during string formatting

If you could post the SQL query and the argument list (sql and arg) it might be
helpful.  We should check that the data we are trying to insert into the
database matches the fields in the table.

Then we come to the new error, AttributeError: 'Cursor' object has no attribute
'insert_id'

I found a question on our own mailing list from Bela Tiwari, 4 November 2005
which shares this new problem and may shed some light on what is going wrong:

Begin quote
-------------------------------------------------------------------
Hello,

I am new to using biopython and biosql. I have been following the information
in the document Basic BioSQL with Biopython to try and get familiar with using
biopython to work with mysql databases and specifically I have tried to load a
Genbank file containing a small bacterial genome into a database.

I believe I have carried out all the instructions correctly (i.e. interpreted
to fit the system I am working on - Debian Sarge). The code and traceback call
that results is:

#############################
>>> >>> from BioSQL import BioSeqDatabase
>>> >>> from Bio import GenBank
>>> >>> server = BioSeqDatabase.open_database(driver="MySQLdb", user="root", host="localhost", db="bioseqdb")
>>> >>> db = server.new_database("testorama7")
>>> >>> parser = GenBank.FeatureParser()
>>> >>> iterator = GenBank.Iterator(open("CP000010.gbk"), parser)
>>> >>> db.load(iterator)
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "/usr/lib/python2.3/site-packages/BioSQL/BioSeqDatabase.py", line 414,
in load
    db_loader.load_seqrecord(cur_record)
  File "/usr/lib/python2.3/site-packages/BioSQL/Loader.py", line 37, in
load_seqrecord
    bioentry_id = self._load_bioentry_table(record)
  File "/usr/lib/python2.3/site-packages/BioSQL/Loader.py", line 225, in
_load_bioentry_table
    taxon_id = self._get_taxon_id(record)
  File "/usr/lib/python2.3/site-packages/BioSQL/Loader.py", line 198, in
_get_taxon_id
    taxon_id = self.adaptor.last_id("taxon")
  File "/usr/lib/python2.3/site-packages/BioSQL/BioSeqDatabase.py", line 148,
in last_id
    return self.dbutils.last_id(self.cursor, table)
  File "/usr/lib/python2.3/site-packages/BioSQL/DBUtils.py", line 34, in
last_id
    return cursor.insert_id()
AttributeError: 'Cursor' object has no attribute 'insert_id'
################################

I have seen information on the web suggesting that MySQLdb has undergone an API
change such that the insert_id() function has moved from the cursor to the
database object. Is it possible that such a change is at the core of my
problem? Or have I just done something wrong?

I am working on Debian Sarge, using biopython version 1.40b (though I have
checked the code for the latest release and nothing under BioSQL has changed). 

Any advice anyone has about how to sort out this error would be greatly
appreciated.

cheers

Bela
-------------------------------------------------------------------
end quote.

Sadly I can't see any follow up emails, nor did she file a bug at the time, so
it looks like this issue was forgotten about.


-- 
Configure bugmail: http://bugzilla.open-bio.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.


More information about the Biopython-dev mailing list