when I execute the following code using python programming language and MySQL database
cursor.execute("select max(propernoun_SRNO) from tblauto_tagged")
starting_index = cursor.fetchone()
ending_index = starting_index +len(s)
I get following error:
Traceback (most recent call last):
File "<pyshell#0>", line 1, in <module>
batch(1,1)
File "C:\Users\vchauhan\Dropbox\Code\proper_noun_function_batch_file_mysql_sept_12.py", line 97, in batch
ending_index = starting_index +len(s)
TypeError: unsupported operand type(s) for +: 'pyodbc.Row' and 'int'
Problem
The problem here is that you are assigning
pyodbc.Rowinstance (returned by.fetchone()) tostarting_index, which makes it impossible to add it to the integer (thus the “TypeError: unsupported operand type(s)” error).Solution
Try to replace this line:
with this line:
More reading
fetchone())