ModuleNotFoundError: No module named ‘openai.error‘

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.handlerse_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.botstypename = create_bot(self.btypetypename) 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、修复方法

  1. Openai版本 退到0.28.0
  2. 把openai.error去掉,然后下面的异常放置到openai下访问。
相关推荐
承渊政道2 小时前
【Python编程快速上手—让繁琐工作自动化】(列表:把数据排成队,从下标取值到深拷贝)
开发语言·python·pycharm·自动化·列表
大胖爱学习_MJ2 小时前
Agent 如何安全地拿数据库密码?基于 HashiCorp Vault 的动态凭证下发
经验分享·python
tryCbest2 小时前
Python 爬虫从入门到实战(一):基础篇——从零写出第一个爬虫
开发语言·爬虫·python
无小道2 小时前
Python语句的特色
python·语句
2601_967980113 小时前
python pytest如何编写测试
python·测试用例·pytest·函数·assert
2601_967980114 小时前
Python中heapq模块的各种用法实例
数据结构·python·算法·应用实例·heapq模块
大胖爱学习_MJ4 小时前
超越向量检索:用 Spring Boot + Neo4j 手搓 GraphRAG 知识图谱记忆
java·后端·python
RobinDevNotes5 小时前
24GB Mac 做数字人:声音放本地,画面租云端
人工智能·python·macos·开发工具
学无止境小袁同学7 小时前
LlamaIndex Workflows 学习
python·llm·tensorflow·llamaindex·agent开发·多agent·workflows
鲸渔7 小时前
【AI Agent系列课程13-Python 基础13】JSON 读写:结构化数据交换基础
开发语言·python·json·ai编程