# pymysql+python3+appium插入数据时出错
执行这条语句时总是出错,但实际上已经插入到数据库里面了,求解!!!错误提示:Traceback(mostrecentcalllast):File"<pyshell#2>"...
执行这条语句时总是出错,但实际上已经插入到数据库里面了,求解!!!
错误提示:
Traceback (most recent call last):
File "<pyshell#2>", line 1, in <module>
cur.execute(sql, (url,'QQ',kehu_name,qq,time2,my_qq))
File "C:\Python33\lib\site-packages\pymysql\cursors.py", line 166, in execute
result = self._query(query)
File "C:\Python33\lib\site-packages\pymysql\cursors.py", line 323, in _query
self._do_get_result()
File "C:\Python33\lib\site-packages\pymysql\cursors.py", line 339, in _do_get_result
self._show_warnings()
File "C:\Python33\lib\site-packages\pymysql\cursors.py", line 355, in _show_warnings
warnings.warn(err.Warning(*w[1:3]), stacklevel=4)
File "C:\Python33\lib\idlelib\PyShell.py", line 60, in idle_showwarning
file.write(warnings.formatwarning(message, category, filename,
AttributeError: 'NoneType' object has no attribute 'write'
# 插入数据
sql = 'INSERT INTO haoyou_list (url,leixing,nicheng,kehu_qq,add_time,my_haoma) VALUES (%s,%s,%s,%s,%s,%s)'
cur.execute(sql, (url,'QQ',kehu_name,qq,time2,my_qq))
#更新数据库
updata = "UPDATE baidushangjia SET yicaiji=1 WHERE url = '%s'" %(str(url))
cur.execute(updata)
connect.commit() 展开
错误提示:
Traceback (most recent call last):
File "<pyshell#2>", line 1, in <module>
cur.execute(sql, (url,'QQ',kehu_name,qq,time2,my_qq))
File "C:\Python33\lib\site-packages\pymysql\cursors.py", line 166, in execute
result = self._query(query)
File "C:\Python33\lib\site-packages\pymysql\cursors.py", line 323, in _query
self._do_get_result()
File "C:\Python33\lib\site-packages\pymysql\cursors.py", line 339, in _do_get_result
self._show_warnings()
File "C:\Python33\lib\site-packages\pymysql\cursors.py", line 355, in _show_warnings
warnings.warn(err.Warning(*w[1:3]), stacklevel=4)
File "C:\Python33\lib\idlelib\PyShell.py", line 60, in idle_showwarning
file.write(warnings.formatwarning(message, category, filename,
AttributeError: 'NoneType' object has no attribute 'write'
# 插入数据
sql = 'INSERT INTO haoyou_list (url,leixing,nicheng,kehu_qq,add_time,my_haoma) VALUES (%s,%s,%s,%s,%s,%s)'
cur.execute(sql, (url,'QQ',kehu_name,qq,time2,my_qq))
#更新数据库
updata = "UPDATE baidushangjia SET yicaiji=1 WHERE url = '%s'" %(str(url))
cur.execute(updata)
connect.commit() 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询