IndexError: Cannot choose from an empty sequence // Werkzeug Debugger var CONSOLE_MODE = false, EVALEX = true, EVALEX_TRUSTED = false, SECRET = "Cztug1SITH6VWk19YYTC";
IndexError
IndexError: Cannot choose from an empty sequence

Traceback(most recent call last)
The above exception was the direct cause of the following exception:File "/usr/local/python3/lib/python3.7/site-packages/flask/app.py", line2551, in__call__
def __call__(self, environ: dict, start_response: t.Callable) -> t.Any:
"""The WSGI server calls the Flask application object as the
WSGI application. This calls :meth:`wsgi_app`, which can be
wrapped to apply middleware.
"""
return self.wsgi_app(environ, start_response)
File "/usr/local/python3/lib/python3.7/site-packages/flask/app.py", line2531, inwsgi_app
try:
ctx.push()
response = self.full_dispatch_request()
except Exception as e:
error = e
response = self.handle_exception(e)
except: # noqa: B001
error = sys.exc_info()[1]
raise
return response(environ, start_response)
finally:
File "/usr/local/python3/lib/python3.7/site-packages/flask/app.py", line2528, inwsgi_app
ctx = self.request_context(environ)
error: t.Optional[BaseException] = None
try:
try:
ctx.push()
response = self.full_dispatch_request()
except Exception as e:
error = e
response = self.handle_exception(e)
except: # noqa: B001
error = sys.exc_info()[1]
File "/usr/local/python3/lib/python3.7/site-packages/flask/app.py", line1825, infull_dispatch_request
request_started.send(self)
rv = self.preprocess_request()
if rv is None:
rv = self.dispatch_request()
except Exception as e:
rv = self.handle_user_exception(e)
return self.finalize_request(rv)
def finalize_request(
self,
rv: t.Union[ft.ResponseReturnValue, HTTPException],
File "/usr/local/python3/lib/python3.7/site-packages/flask/app.py", line1823, infull_dispatch_request
try:
request_started.send(self)
rv = self.preprocess_request()
if rv is None:
rv = self.dispatch_request()
except Exception as e:
rv = self.handle_user_exception(e)
return self.finalize_request(rv)
def finalize_request(
File "/usr/local/python3/lib/python3.7/site-packages/flask/app.py", line1799, indispatch_request
and req.method == "OPTIONS"
):
return self.make_default_options_response()
# otherwise dispatch to the handler for that endpoint
view_args: t.Dict[str, t.Any] = req.view_args # type: ignore[assignment]
return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)
def full_dispatch_request(self) -> Response:
"""Dispatches the request and on top of that performs request
pre and postprocessing as well as HTTP exception catching and
error handling.
File "/www/wwwroot/chat.py", line39, ingen_header
# post入参访问方式二:from-data(k-v)格式参数
@api.route('/gen_header', methods=['post'])
def gen_header():
wd = flask.request.values.get('wd')
future = executor.submit(do_heavy_work,wd)
return str(future.result())
def do_heavy_work(wd):
prompt = wd
#openai.api_key = api_key_list[-1]
openai.api_key = random.choice(api_key_list)
File "/usr/local/python3/lib/python3.7/concurrent/futures/_base.py", line435, inresult
self._condition.wait(timeout)
if self._state in [CANCELLED, CANCELLED_AND_NOTIFIED]:
raise CancelledError()
elif self._state == FINISHED:
return self.__get_result()
else:
raise TimeoutError()
def exception(self, timeout=None):
"""Return the exception raised by the call that the future represents.
File "/usr/local/python3/lib/python3.7/concurrent/futures/_base.py", line384, in__get_result
with self._condition:
return self._state in [CANCELLED, CANCELLED_AND_NOTIFIED, FINISHED]
def __get_result(self):
if self._exception:
raise self._exception
else:
return self._result
def add_done_callback(self, fn):
"""Attaches a callable that will be called when the future finishes.IndexError: Cannot choose from an empty sequence
This is the Copy/Paste friendly version of the traceback.
concurrent.futures.process._RemoteTraceback: """Traceback (most recent call last): File "/usr/local/python3/lib/python3.7/concurrent/futures/process.py", line 239, in _process_worker r = call_item.fn(*call_item.args, **call_item.kwargs) File "/www/wwwroot/chat.py", line 44, in do_heavy_work openai.api_key = random.choice(api_key_list) File "/usr/local/python3/lib/python3.7/random.py", line 261, in choice raise IndexError('Cannot choose from an empty sequence') from NoneIndexError: Cannot choose from an empty sequence"""The above exception was the direct cause of the following exception:Traceback (most recent call last): File "/usr/local/python3/lib/python3.7/site-packages/flask/app.py", line 2551, in __call__ return self.wsgi_app(environ, start_response) File "/usr/local/python3/lib/python3.7/site-packages/flask/app.py", line 2531, in wsgi_app response = self.handle_exception(e) File "/usr/local/python3/lib/python3.7/site-packages/flask/app.py", line 2528, in wsgi_app response = self.full_dispatch_request() File "/usr/local/python3/lib/python3.7/site-packages/flask/app.py", line 1825, in full_dispatch_request rv = self.handle_user_exception(e) File "/usr/local/python3/lib/python3.7/site-packages/flask/app.py", line 1823, in full_dispatch_request rv = self.dispatch_request() File "/usr/local/python3/lib/python3.7/site-packages/flask/app.py", line 1799, in dispatch_request return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args) File "/www/wwwroot/chat.py", line 39, in gen_header return str(future.result()) File "/usr/local/python3/lib/python3.7/concurrent/futures/_base.py", line 435, in result return self.__get_result() File "/usr/local/python3/lib/python3.7/concurrent/futures/_base.py", line 384, in __get_result raise self._exceptionIndexError: Cannot choose from an empty sequenceThe debugger caught an exception in your WSGI application. You can now look at the traceback which led to the error. If you enable JavaScript you can also use additional features such as code execution (if the evalex feature is enabled), automatic pasting of the exceptions and much more.Brought to you byDON'T PANIC, your friendly Werkzeug powered traceback interpreter.Console Locked
The console is locked and needs to be unlocked by entering the PIN. You can find the PIN printed out on the standard output of your shell that runs the server.
PIN:
1、隔夜饭能吃两次吗?
优质回答1:看情况
如果隔夜饭没有变质,则可以食用,但是不宜经常吃隔夜饭菜,其中会形成一种叫做亚硝酸盐的物质,存在致癌的风险。建议多吃新鲜的食物,饮食上加强营养摄入,有利于自身健康。
米饭隔夜之后是可以食用的。只要米饭没有出现异味和变质的症状,进行食用对身体一般是不会有很影响的。不过对于剩菜就建议不要进行食用了,因为含有亚硝酸盐,经常吃会有致癌的风险
优质回答2:隔夜饭肯定没有新鲜的饭吃了好的,但能不能吃两次隔夜饭,主要取决于是吃了多久的隔夜饭。如果是偶尔吃,那么吃两顿也是没有问题的,如果经常都吃隔夜饭,那么肯定会跟身体带来坏的影响,久而久之,也就不是这两次的问题,那会造成不可逆的身体健康问题,所以,最好是不要吃两次。
优质回答3:如果不坏,还可以吃的,但是不能经常吃,最好不吃,因为你经常吃对人身体有害的,一句时候隔夜饭也会产生毒素的
2、隔夜米饭还能吃吗?
优质回答1:可以吃。
因为米饭中含有淀粉,经过冷却后,淀粉会形成抗性淀粉,具有一定的营养价值。
但是要注意在保存过程中避免细菌滋生,最好在放入冰箱后24小时内食用。
另外,隔夜米饭如果要再次食用,最好用微波炉或蒸锅热过,这样能有效杀灭细菌,减小食品安全隐患。
隔夜米饭一般来说是可以食用的,但需要注意以下问题:
1. 存放时间:隔夜米饭一般可以在室温下保存2-3小时,超过该时间后,细菌容易滋生,导致米饭变质。最好是将米饭放入冰箱冷藏保存,可以保存至24小时左右,不建议放置时间过长食用。
优质回答3:可以吃,但要注意保存方式和加热方式。隔夜米饭容易滋生细菌,保存时应将米饭放在密闭容器中,放入冰箱冷藏。加热时,可以用微波炉加热,也可以用锅热油后加入米饭煸炒。另外,如果米饭呈现异味或者变质,就不建议食用了。
3、做好的饭可以过夜吗?
优质回答1:最好不要过夜,尽量避免吃隔夜的饭菜,特别是天气热,很容易坏,即便是天气凉爽,或者放在冰箱,做好的饭放在那里,都会滋生细菌,对人体产生危害,尽量控制时间,第二天早点煮,或者想想别的办法,不要把饭菜过夜,或者直接煮好按保温键,这样或许还好一些。
优质回答2:做好的饭不可以过夜。因为放的时间太长了,容易变味,滋生细菌。
优质回答3:最好不要过夜,如果实在没吃完也可以放冰箱冷藏
优质回答4:冬天没问题,夏天最好放冰箱里。如果不放冰箱,可以把锅直接放在一盆冷水里里面凉着。
4、两天的隔夜饭能吃吗?
肯定不能吃啦,吃了伤害身体不划算,倒了也没啥可惜的,身体最重要,新鲜煮出来的米饭多好吃呀,不新鲜的隔夜菜最好都不要吃,就算当时没事,那时间久了就有事了,毒素都是慢慢累积的,不要觉得是在节约,实际是在毁身体不划算的,所以直接倒掉就好
5、隔夜食物不能吃吗?为什么?
吃隔夜的剩菜对身体健康究竟有多不好?你知道吗?
从小到大,我们中国人都知道要爱惜粮食,因此,大部分人会把头天晚上剩下的菜,或者富裕出的菜,留作第二天午餐。其实这样做是很不健康的!
一般来说荤菜,鱼、肉、家禽等,相比之下要好一点,肉类食物只要密封保存在冰箱中,一般不会滋生有害物质,食用时只要彻底加热就可以,虽然会损失一些营养物质,但是蛋白质还是可以完全保留下来的。
但是蔬菜,尤其是绿叶蔬菜,炒熟后如果不及时吃掉,就比较危险了!维生素的损失还是小事儿,最关键的一点是,剩菜极容易产生一种对人体健康十分不利的物质——亚硝酸盐。
如果饭菜做多了,我们应该怎么办呢?
1.留荤不留素
由于荤素营养物质不同的原因,我建议荤菜可以留,但素菜,尤其是叶类蔬菜,千万不要留
2.剩菜及时放冰箱
如果一看就知道这道菜今天这顿是吃不完的,又不舍得扔掉,那就起锅后放到盘子里或者保鲜盒里,稍微凉一下后放入冰箱保存到下一顿再吃。如果菜放到饭桌上,被你一筷子他一筷子翻动后再放入冰箱,被微生物污染的几率大大增加,硝酸盐的含量也会大大增加。
3、保存时间不要太长
就算剩菜及时放入冰箱里保存,保存时间也不要超过24小时。有研究表明,清炒蔬菜在冰箱中放置24h内,虽然亚硝酸的含量并没有大幅度增加,在可食用的安全范围之类。但是其他营养素如维生素C等降解的厉害,口感色泽都失去了原来的模样,并不建议食用。
4、下一顿食用前,需要彻底加热
吃多少热多少,切记不要反复加热。加热是一个消毒杀菌的过程,彻底加热能够杀死很多致病菌,食用更安全。
版权声明:免责声明:本文来源网友投稿及网络整合仅代表文章作者的个人观点,与本站无关。其原创性、真实性以及文中陈述文字和内容未经本站证实,对本文以及其中全部或者部分内容文字的真实性、完整性和原创性本站不作任何保证或承诺,请读者仅作参考,并自行核实相关内容。投诉邮箱:1765130767@qq.com.