[Tutor] CSV file processing...

Marc Tompkins marc.tompkins at gmail.com
Fri Mar 21 20:55:36 CET 2008


On Fri, Mar 21, 2008 at 12:42 PM, Spencer Parker <inthefridge at gmail.com>
wrote:

> This is all that I get when I run it...
>
> Traceback (most recent call last):
>   File "./loadcsv.py", line 23, in ?
>     co.execute("""
>   File "/usr/lib64/python2.4/site-packages/MySQLdb/cursors.py", line 148,
> in execute
>     query = query % db.literal(args)
> TypeError: not all arguments converted during string formatting
>

>         co.execute("""
> > >             INSERT INTO stats VALUES
> > >
> > (%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s);
> > >         """,row)
> >
>
You have triple quotes around your SQL.  That means that "implied" line
breaks become real.  It won't look as nice, but take the line breaks out and
I think it ought to work.

Just my $.02...

-- 
www.fsrtechnologies.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20080321/8b0ee68b/attachment.htm 


More information about the Tutor mailing list