python创建sqlite3 unicode error_python/sqlite3:发生异常:sqlite3.operationalerror
我正在嘗試創(chuàng)建一個(gè)函數(shù)來處理API錯(cuò)誤消息,但是我在python中得到了這個(gè)錯(cuò)誤消息:
Exception has occurred: sqlite3.OperationalError
near "Test4": syntax error
服務(wù)器響應(yīng)為:
{"message":"Failed to validate one or more request parameters","validationErrors":["Budget name must be unique. 'Test4 - X4574747-PHONE' already exits"]}
我的代碼是:
def error():
if "message" in r.json():
logText = time.strftime('%Y-%m-%d %H:%M:%S', time.localtime()) + " : " + r.json()['message']
c.execute("INSERT INTO log VALUES ('"+ logText +"')")
conn.commit()
if "validationErrors" in r.json():
logText = time.strftime('%Y-%m-%d %H:%M:%S', time.localtime()) + " : " + r.json()['validationErrors'][0]
c.execute("INSERT INTO log VALUES ('"+ logText +"')")
conn.commit()
os._exit(1)
我不知道是什么導(dǎo)致了這個(gè)錯(cuò)誤。任何幫助都將不勝感激。謝謝您。
總結(jié)
以上是生活随笔為你收集整理的python创建sqlite3 unicode error_python/sqlite3:发生异常:sqlite3.operationalerror的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 【NLP】bert4vec:一个基于预训
- 下一篇: 【机器学习】机器学习模型验证,这3个 P