ModuleNotFoundError: No module named ‘openai.error’
result = self.fn(*self.args, **self.kwargs) File “H:\chatGPTWeb\chatgpt-on-wechat\channel\chat_channel.py”, line 168,
in _handle
reply = self._generate_reply(context) File “H:\chatGPTWeb\chatgpt-on-wechat\channel\chat_channel.py”, line 178,
in _generate_reply
e_context = PluginManager().emit_event( File “H:\chatGPTWeb\chatgpt-on-wechat\plugins\plugin_manager.py”, line 189,
in emit_event
instance.handlers[e_context.event](e_context, *args, **kwargs) File “H:\chatGPTWeb\chatgpt-on-wechat\plugins\role\role.py”, line 104,
in on_handle_context
bot = Bridge().get_bot(“chat”) File “H:\chatGPTWeb\chatgpt-on-wechat\bridge\bridge.py”, line 53, in
get_bot
self.bots[typename] = create_bot(self.btype[typename]) File “H:\chatGPTWeb\chatgpt-on-wechat\bot\bot_factory.py”, line 22, in
create_bot
from bot.chatgpt.chat_gpt_bot import ChatGPTBot File “H:\chatGPTWeb\chatgpt-on-wechat\bot\chatgpt\chat_gpt_bot.py”, line 6,
in
import openai.error ModuleNotFoundError: No module named ‘openai.error’
1、错误原因
Openai升级之后,openai.error 被去掉了。
参考解决方案:https://github.com/openai/openai-python/issues/840(访问前请注意上网环境)
2、修复方法
- Openai版本 退到0.28.0
- 把openai.error去掉,然后下面的异常放置到openai下访问。