ValueError: too many values to unpack
Rich Shepard <[email protected]>
| Newsgroups | gmane.comp.python.db.pysqlite.user |
|---|---|
| Message-ID | <[email protected]> |
My application has a table named 'model' with this schema:
CREATE TABLE model (model_name TEXT NOT NULL PRIMARY KEY,
model_desc TEXT, model_type TEXT, keName TEXT, agent INTEGER);
and it holds one record.
During testing I created a new database and inserted values in each of
these fields. But, when I open the existing database to read each column and
insert the values in the appropriate GUI widgets, I get the error message on
the subject line:
File "/data1/eikos/modelPage.py", line 198, in OnOpenMod
for (model_desc, model_type, keName, agent) in self.appData.cur:
ValueError: too many values to unpack
What I'm trying to do in this method (starting at line 197) is,
self.appData.cur.execute("select * from model")
for (model_desc, model_type, keName, agent) in self.appData.cur:
modDesc = model_desc
mType = model_type
knowlEng = keName
method = agent
self.tcDesc.SetValue(modDesc)
self.modType.SetString(self.modType.SetSelection(mType))
self.keName.SetValue(knowlEng)
self.agent.SetSelection(method)
My newness to pysqlite is undoubtably the reason why I have the syntax
incorrect, and I did read the appropriate section in the on-line doc on how
to extract each table record into a local variable. I thought the 'for ...'
loop syntax was appropriate when there's a single record, and I did not need
to use fetchone(). What is the appropriate syntax?
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