Re: ValueError: too many values to unpack

Rich Shepard <[email protected]>
Newsgroups gmane.comp.python.db.pysqlite.user
Message-ID <[email protected]>
On Thu, 30 Nov 2006, [email protected] wrote:

> I meant to say column and typed rows, sorry about that, but again, my
> advice is to avoid select * when you can. Just to avoid things in the
> future if you ever add a column to your table, then you have to change all
> your legacy code to handle the added column value being returned.

Greg,

   Using this format:

       self.appData.cur.execute("select * from model")
       for row in self.appData.cur:
       modDesc = row[1]
       mType = row[2]
       knowlEng = row[3]
       method = row[4]

also works. If another column is added to the table, I can retrieve it with
the array index.

> BTW, I rarely follow my own advice and am always fixing bugs because of
> it :)

   It's always easier to fix others than it is to fix ourselves.

Rich

-- 
Richard B. Shepard, Ph.D.               |    The Environmental Permitting
Applied Ecosystem Services, Inc.(TM)    |            Accelerator
<http://www.appl-ecosys.com>     Voice: 503-667-4517      Fax: 503-667-8863
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.