Updating SQL table problems with python

DJ dj3000 at iinet.net.au.nospam
Wed Jun 4 04:22:25 EDT 2003


Hi there,

I get a Syntax error from this following SQL statement:

file_open = urllib.urlopen(url)
xmldoc = minidom.parse(file_open)
file_open.close()
blah = xmldoc.toxml()
title = minidom.parseStrin(blah).getElementsByTagNam('title')

connection = gadfly.gadfly("portal", "dbase")
cursor = connection.cursor()
for x in title:
        j = x.firstChild.data
        j = j.encode('ascii', 'replace')
        cursor.execute("update items set title = '%s' where title = 'Title'"
% j)
        connection.commit()

As you can tell, im parsing a xml RSS feed and updating items table. Im
trying to replace
default value of 'Title' with the title from the RSS feed.
The update statement is givng me the syntax error
I cant see whats wrong

Need some help
Thanks in advance
Adam






More information about the Python-list mailing list