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:
我喜欢打动人心一点的歌,但对于歌词却嫌恶者多,无它,多穿凿堆砌耳。今听“无期”,用词摒弃华丽,感觉自以为懂了这个故事,试浅释之。
夜半风雨声
惊醒梦中人
在秋后的一个深夜,我被屋外的风雨声从梦中惊醒。梦很重要,说明作者睡的并不好,可能正做着回忆的梦。
谁在立秋之后
时常来叩门
古人以秋为愁,立秋之后,来扣门的不是风雨,是点点滴滴的前尘往事因景生情,涌上心头。
若终其一生
仍为情所困
宁愿开始
就只一个人
点明原因,作者愁的来源是为情所困,困的很深,很难挣扎,以至于作者宁愿一开始就没有这段情,正如仓央嘉措说的“最好不相见,便可不相恋;最好不相知,便可不相思。”
清晨一盏灯
照亮了前尘
灯是晚上用的,为何清晨还点着灯,因为作者彻夜难眠,或者是作者一夜未熄,或者是惊醒后再也无法入睡。作者未睡,那干了什么呢,照亮前尘实际是照亮了前尘往事,他陷入了回忆,回忆的又是什么?
谁在大雪之前
以手来赶针
若心有余温
从不感觉冷
虽然最终
都还一个人
回忆的是:一个大雪即将到来的冬日,女子为作者缝制冬衣,一个赶字用的好,女子在赶针,赶就是很急的意思,女子为什么赶,因为她怕做的晚了,心上人不能早点穿到衣服会受寒。用情若此,难怪作者念念不忘,不禁喃喃自语“只要我的心理还有你的一点余温,我也不会感到寒冷,哪怕我现在还是一个人”。如果你等过一个人,就会明白这种感觉:每一次手机提示音,都以为是你回复的消息;每一次柴扉轻叩,都以为是你在等我开门。所以哪怕是夜半也会惊醒。这深秋的风雨也真是恼人,总是频频弄出响动,让人惊喜地飞奔而出,又失望地落寞而归。既无睡意,便燃一盏灯,为你赶制棉衣。把浓浓的情意,缝到一针一线里。只盼大雪之前,若你回来,便有新衣御寒。虽然最终不一定有机会为你穿上身,但是在做的时候,我真的是满腔热忱。就像你在身边的时候,我未曾羡慕过任何人。
前路漫漫雨纷纷
谁在痴痴等
任其心头千般恨
不做负心人
若爱得越真
就陷得越深
断了缘分
就只剩离分
回忆完了,那回到眼前。前路漫漫,细雨纷纷,作者依然没有归期,无论作者求的是名是利,都还在困顿期,前途茫茫。“谁在痴痴等”既是作者对自己渺茫的前途不放弃,在等,也是那位女子为自己渺茫的情感在等。长久的等就会有千般的滋味,但不管怎样,初心不变,那就是“不做负心人”。在这里,情感是升华的,是美好的,也正因此,值得我们赞颂。
原来“无期”,不是看不清未来,而是等不到归人。
这世上,多的是爱而不得。愿你良人在侧,安好喜乐!
版权声明:免责声明:本文来源网友投稿及网络整合仅代表文章作者的个人观点,与本站无关。其原创性、真实性以及文中陈述文字和内容未经本站证实,对本文以及其中全部或者部分内容文字的真实性、完整性和原创性本站不作任何保证或承诺,请读者仅作参考,并自行核实相关内容。投诉邮箱:1765130767@qq.com.