このコードは昨日正常に機能し、cronジョブとして実行されていました。突然、今日はそうではなく、私はこのエラーを受け取ります:
Traceback (most recent call last):
File "C:/Users/ac33g1r1/Documents/BD_Scripts/test plist 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",))
私は検索しましたが、なぜこれが突然変わったのか理解できません。PythonのバージョンはWindowsServer2008では3.3.0です。このcronジョブを再び機能させたいのですが、実際の原因はわかりません。
コードは次のとおりです。
import pymysql
conn = pymysql.connect(host='1.2.3.4', port = 1234, user = 'uname', passwd='pword', db='db_x')
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 queuelist(itemID, sortID)
VALUES(%s,%s)""",
[plist[sid], lastQ[0]] )
cur.close()
conn.close()