> -----Original Message-----
> From: Paul DuBois [mailto:[EMAIL PROTECTED]
> Sent: Thursday, July 17, 2003 9:38 PM
> To: Nick Arnett; [EMAIL PROTECTED]

Well, Paul, just knowing you were on the job inspired me and I finally
realized the dumb thing I'd done.  The list I'm iterating, urls, comes from
a single-column MySQL results list, so it's a list of tuples (url,), not
strings.  That's why I open url[0], rather than just url in the first line
inside the loop.  I was smart enough to do that, but not smart enough to
remember to use url[0], rather than url, in the INSERT statement.  So I was
trying to insert a tuple, not a string, and thus MySQL barfed.

> >for url in urls:
> >     doc = urllib.urlopen(url[0]).read()
> >     dbh.execute("INSERT INTO rss_article (body,url) VALUES (%s,
> %s)",(doc,
> >url))
> >     dbh.execute("UPDATE rss_item SET cached = '1' WHERE url =
> %s",(url,))


> - Have you tried this with *short* HTML documents? What happens?
>    This would help you determine whether it's a length-of-data issue.
> - Let's see an actual error message (at least the first part), and
> the corresponding text of the document.
> - What shows up in the server's query log?

By the way, what helped me figure this out was switching the column names
and values, which changed the string in the error message to "))", rather
than the start of the HTML doc.  That's when I realized the problem was
something about url, not the HTML.

This one has bitten me before, but it's been a long time...

Nick


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to