This is all that I get when I run it...<br><br>Traceback (most recent call last):<br>&nbsp; File &quot;./loadcsv.py&quot;, line 23, in ?<br>&nbsp;&nbsp;&nbsp; co.execute(&quot;&quot;&quot;<br>&nbsp; File &quot;/usr/lib64/python2.4/site-packages/MySQLdb/cursors.py&quot;, line 148, in execute<br>
&nbsp;&nbsp;&nbsp; query = query % db.literal(args)<br>TypeError: not all arguments converted during string formatting<br><br><br><div class="gmail_quote">On Fri, Mar 21, 2008 at 1:34 PM, Kent Johnson &lt;<a href="mailto:kent37@tds.net">kent37@tds.net</a>&gt; wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div class="Ih2E3d">Spencer Parker wrote:<br>
&gt; I posted it in a previous message on the list...but here it is...<br>
<br>
</div>Looks new to me...<br>
<div class="Ih2E3d">&gt;<br>
&gt; #!/usr/bin/python<br>
&gt;<br>
&gt; import MySQLdb<br>
&gt; import csv<br>
&gt; import sys<br>
&gt;<br>
&gt; try:<br>
&gt; &nbsp; &nbsp; db = MySQLdb.connect (host = &quot;localhost&quot;,user = &quot;root&quot;,passwd =<br>
&gt; &quot;Ch33s3Monk3y&quot;,db = &quot;xenstats&quot;)<br>
&gt; except MySQLdb.Error, e:<br>
&gt; &nbsp; &nbsp; print &quot;Error %d: %s&quot; % (e.args[0], e.args[1])<br>
&gt; &nbsp; &nbsp; sys.exit (1)<br>
&gt;<br>
&gt; try:<br>
&gt; &nbsp; &nbsp; co = db.cursor()<br>
&gt; &nbsp; &nbsp; csv_data = csv.reader(file(&#39;output.txt&#39;,&#39;r&#39;))<br>
&gt; &nbsp; &nbsp; headers = csv_data.next()<br>
&gt; &nbsp; &nbsp; row = csv_data.next()<br>
&gt; &nbsp; &nbsp; prefix = row[:20]<br>
&gt; &nbsp; &nbsp; for i in range(20, len(row), 7):<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; next = prefix + row[i:i+7]<br>
&gt;<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; for row in csv_data: print next<br>
<br>
</div>Why do you have this loop? You only want to process one row, right?<br>
<div class="Ih2E3d"><br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; co.execute(&quot;&quot;&quot;<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; INSERT INTO stats VALUES<br>
&gt; (%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);<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;,row)<br>
<br>
</div>Should be next - the processed data - not row - the raw data.<br>
<br>
You still didn&#39;t show the actual error message. After the traceback<br>
there should be an error.<br>
<font color="#888888"><br>
Kent<br>
</font></blockquote></div><br><br clear="all"><br>-- <br>Spencer Parker<br>_______________________________________________________<br><br>&quot;if you can&#39;t go to heaven, may you at least die in Ireland.&quot;<br><br>
_______________________________________________________