审核新闻,删除新闻,添加用户,修改用户,删除用户报错
来源:1-11 实战:完成新闻管理系统的用户模块
阿邸
2020-05-04 11:33:41
os.system("cls")
print(Fore.LIGHTGREEN_EX, "\n\t1.审批新闻")
print(Fore.LIGHTGREEN_EX, "\n\t2.删除新闻")
print(Fore.BLUE, "\n\t---------------")
print(Fore.LIGHTRED_EX, "\n\tback.返回上一层")
print(Style.RESET_ALL)
opt = input("\n\t请输入操作编号:")
# 审批新闻
if opt == "1":
page = 1
while True:
os.system("cls")
count_page = __news_service.search_unreview_count_page()
result = __news_service.search_unreview_list(page)
for index in range(len(result)):
one = result[index]
print(Fore.LIGHTBLUE_EX, "\n\t{}\t{}\t{}\t{}".format((index+1), one[1], one[2], one[3]))
print("\n")
print(Fore.LIGHTBLUE_EX, "\n\t{}/{}".format(page, count_page))
print(Fore.BLUE, "\n\t-------------------------------")
print(Fore.LIGHTRED_EX, "\n\tback.返回上一层")
print(Fore.LIGHTRED_EX, "\n\tprev.上一页")
print(Fore.LIGHTRED_EX, "\n\tnext.下一页")
print(Style.RESET_ALL)
opt = input("\n\t请输入操作编号:")
if int(opt) >= 1 and int(opt) <= 10:
news_id = result[int(opt)-1][0]
__news_service.update_unreview_news(news_id)
elif opt == "back":
break
elif opt == "prev" and page > 1:
page -= 1
elif opt == "next" and page < count_page:
page += 1程序运行后可循环审核两条,审核第三条时报错
Failed getting connection; pool exhausted
Traceback (most recent call last):
File "E:\PythonLearn\Work\Vega\vega01\app.py", line 143, in <module>
for index in range(len(result_insert)):
TypeError: object of type 'NoneType' has no len()
提示对象没有len()属性
1回答
时间,
2020-05-06
同学,你好。报错信息是池耗尽,连接失败。同学可以重新启动项目,或者在每次执行完后删除连接,将连接归还给连接池

如果我的回答解决了您的疑惑,请采纳!祝学习愉快~~~~
相似问题