运行 python 出现错误

运行python出现错误

……

File "spider.py", line 89, in commit
self.dbconn.commit()
AttributeError: 'NoneType' object has no attribute 'commit'

哪位大侠帮帮看看怎么回事,谢谢!

讨论数量: 1
Jason990420

AttributeError: 'NoneType' object has no attribute 'commit'
我想......
NoneTyped 指的是第89行中物件是'None', 去呼叫某一方法, 其結果當然出錯-
通常原因是Return = method(), 而method()没有return, 所以Return為None
也就是self.dbconn是None...所以得這樣的結果

5年前 评论

讨论应以学习和精进为目的。请勿发布不友善或者负能量的内容,与人为善,比聪明更重要!