Re: Do Not See My Error

Rich Shepard <[email protected]>
Newsgroups gmane.comp.python.db.pysqlite.user
Message-ID <[email protected]>
On Wed, 13 Sep 2006, dcharno wrote:

> Probably a blank line at the end of the input file.

   There is ... was a blank line at the end, but this issue seems to be with
a single line.

> Also, you have to strip off the '\n' at the end of the each line

   I did see that. Part of my confusion is the sequence type that pysqlite
expects: string, list, tuples? The example on the web site shows the data as
tuples (last_name, age); does this matter?

> ... and dump out of the while loop at the end of the file.

   Thought that I had. The error showed up when I pressed [Enter] after the
cur.execute() statement.

> for l in fh.xreadlines():
>    l = l[:-1]
>    if len(l) == 0: break
>    v= l.split(',')
>    cur.execute("insert into...;", v)

   I'll try this. What's the difference between readlines() and xreadlines()?

Thanks,

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.