gpt4 book ai didi

python - FutureWarning 未显示 warnings.simplefilter(action = "error", category=FutureWarning)

转载 作者:行者123 更新时间:2023-12-04 03:45:41 25 4
gpt4 key购买 nike

我无法找到产生 FutureWarning 消息的代码行:元素比较失败。

SO 中还有其他问题描述了导致此警告的 python/numpy 冲突。我试图在我的代码中找出是哪几行导致了这个问题。

当我在代码的标题部分包含这些行时:

import warnings
warnings.simplefilter(action = "default", category=FutureWarning)

然后警告消息显示在控制台输出上,但没有信息来确定问题发生的位置。

当我包含这些行时:

import warnings
warnings.simplefilter(action = "error", category=FutureWarning)

则不会显示警告消息。

我也用过

warnings.filterwarnings()

参数与simplefilter相同,结果相同。

我正在尝试运行代码并生成标识违规行的回溯。

我做错了什么?

最佳答案

尝试删除您的警告/过滤器警告并改为添加:

numpy.seterr(all='raise')

如果按预期进行,它将在发生异常时引发异常。

更多信息:

关于python - FutureWarning 未显示 warnings.simplefilter(action = "error", category=FutureWarning),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65191048/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com