I posted it in a previous message on the list...but here it is...<br><br>#!/usr/bin/python<br><br>import MySQLdb<br>import csv<br>import sys<br><br>try:<br>&nbsp;&nbsp;&nbsp; db = MySQLdb.connect (host = &quot;localhost&quot;,user = &quot;root&quot;,passwd = &quot;Ch33s3Monk3y&quot;,db = &quot;xenstats&quot;)<br>
except MySQLdb.Error, e:<br>&nbsp;&nbsp;&nbsp; print &quot;Error %d: %s&quot; % (e.args[0], e.args[1])<br>&nbsp;&nbsp;&nbsp; sys.exit (1)<br><br>try:<br>&nbsp;&nbsp;&nbsp; co = db.cursor()<br>&nbsp;&nbsp;&nbsp; csv_data = csv.reader(file(&#39;output.txt&#39;,&#39;r&#39;))<br>&nbsp;&nbsp;&nbsp; headers = csv_data.next()<br>
&nbsp;&nbsp;&nbsp; row = csv_data.next()<br>&nbsp;&nbsp;&nbsp; prefix = row[:20]<br>&nbsp;&nbsp;&nbsp; for i in range(20, len(row), 7):<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; next = prefix + row[i:i+7]<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; for row in csv_data: print next<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; co.execute(&quot;&quot;&quot;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 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);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &quot;&quot;&quot;,row)<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; co.close()<br><br>except MySQLdb.Error, e:<br>&nbsp;&nbsp;&nbsp; print &quot;Error %d: %s&quot; % (e.args[0], e.args[1])<br>&nbsp;&nbsp;&nbsp; sys.exit (1)<br><br>db.commit()<br>db.close()<br><br><div class="gmail_quote">
On Fri, Mar 21, 2008 at 1:18 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; Okay...so I got it mostly working...it now dies with this trackback:<br>
<br>
</div>It would be helpful to see what &#39;it&#39; is (i.e. your code), and also to<br>
see the actual error message as well as the traceback. We try to read<br>
minds on this group but we aren&#39;t really very good at it.<br>
<font color="#888888"><br>
Kent<br>
</font><div><div></div><div class="Wj3C7c"><br>
&gt;<br>
&gt; Traceback (most recent call last):<br>
&gt; &nbsp; File &quot;./loadcsv.py&quot;, line 23, in ?<br>
&gt; &nbsp; &nbsp; co.execute(&quot;&quot;&quot;<br>
&gt; &nbsp; File &quot;/usr/lib64/python2.4/site-packages/MySQLdb/cursors.py&quot;, line<br>
&gt; 148, in execute<br>
&gt; &nbsp; &nbsp; query = query % db.literal(args)<br>
</div></div></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>_______________________________________________________