python创建sqlite3 unicode error_python/sqlite3:发生异常:sqlite3.operationalerror
我正在嘗試創建一個函數來處理API錯誤消息,但是我在python中得到了這個錯誤消息:
Exception has occurred: sqlite3.OperationalError
near "Test4": syntax error
服務器響應為:
{"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)
我不知道是什么導致了這個錯誤。任何幫助都將不勝感激。謝謝您。
總結
以上是生活随笔為你收集整理的python创建sqlite3 unicode error_python/sqlite3:发生异常:sqlite3.operationalerror的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 【NLP】bert4vec:一个基于预训
- 下一篇: 112页数学知识整理!机器学习-数学基础