I’m using python with Beautifulsoup4 to parse some html. All that works well.
My problem is that I seem not to be able to insert the result into a database and
I get the following error.
"Failed processing format-parameters; %s" % e)mysql.connector.errors.ProgrammingError: Failed processing format-parameters; 'MySQLConverter' object has no attribute '_navigablestring_to_mysql'
This is the main gist of the code:
add_q = ("INSERT INTO quotes"
"(name, quote) "
"VALUES (%s, %s)")
def getNodes(cnx):
cursor = cnx.cursor()
for x in range(20,21):
qArr = []
qAuth = []
docstr = getUrlString(url_base,x)
html_doc = getHtmlDoc(docstr)
soup = BeautifulSoup(html_doc.text)
for node in soup.findAll(attrs={'class': 'bqQuoteLink'}):
qArr.append(node.a.string)
for anode in soup.findAll(attrs={'class': 'bodybold'},limit=len(qArr)):
qAuth.append(anode.a.string)
for i in range(len(qArr)):
val1 = qAuth*
val2 = qArr*
cursor.execute(add_q,(val1,val2))
cursor.close()
I have no idea what the problem is?
Thanks!