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. Cause of error
After Openai was upgraded, openai.error was removed.
Reference solution: https://github.com/openai/openai-python/issues/840 (please pay attention to the Internet environment before accessing)
2. Repair method
- Openai version returned to 0.28.0
- Remove openai.error, and then place the following exception for access under openai.