My Python environment:
Python 3.3.0 (v3.3.0:bd8afb90ebf2, Sep 29 2012, 10:57:17) [MSC v.1600 64 bit (AMD64)] on win32
I have a script that has been running for months. It's a cron job and suddenly it started throwing this error:
pymysql.err.Error: (<class 'TypeError'>, TypeError("'int' does not support the buffer interface",))
I don't understand why it had been working fine and just started throwing this error.
Here's the code,
followed by the full error message
import pymysql
conn = pymysql.connect(host='1.2.3.4', port = 1234, user = 'user', passwd='passwd', db='db')
cur = conn.cursor()
lastQ = [165]
plist = [3327, 2145, 3429, 3442, 2905, 3339, 2628, 1655, 1831, 3202, 2551, 2110]
###Debug statements
print("plist")
print(len(plist))
print ("\n")
print("last[Q]")
print(lastQ[0] )
print ("\n")
lastQ[0] = lastQ[0] + 1
print(lastQ[0] )
# Code that is throwing error
for sid in range(len(plist)):
lastQ[0] = lastQ[0] + 1
cur.execute("""INSERT INTO TableX (itemID, sortID)
VALUES (%s, %s)""",
[plist[sid], lastQ[0] ] )
cur.close()
conn.close()
The Full output, including error is:
>>> ================================ RESTART ================================
>>>
plist
12
last[Q]
165
166
Traceback (most recent call last):
File "C:/...... script.py", line 28, in <module>
[plist[sid], lastQ[0] ] )
File "C:\Python33\pymysql\cursors.py", line 117, in execute
self.errorhandler(self, exc, value)
File "C:\Python33\pymysql\connections.py", line 187, in defaulterrorhandler
raise Error(errorclass, errorvalue)
pymysql.err.Error: (<class 'TypeError'>, TypeError("'int' does not support the buffer interface",))
>>>
I don't understand what the error actually is from this message
Thanks