Qt/PyQt5等QFileDialog打开文件错误提示log4cplus:ERROR

博客主要讨论了在使用PyQt5的QFileDialog时遇到的log4cplus错误提示,该错误不影响功能但会显示大量错误日志。错误源于Autodesk360的AdSyncNamespace.dll动态链接库。解决方案是重命名或移除该文件。此外,博客还提到在源码中未找到相关关键字,并在AdSyncNamespace.dll中发现了log4cplus的相关引用。
D:\bert\pythonProject\.venv\Scripts\python.exe D:\bert\pythonProject\.venv\Lib\xinxinde.py Qt: Untested Windows version 10.0 detected! log4cplus:ERROR No appenders could be found for logger (AdSyncNamespace). log4cplus:ERROR Please initialize the log4cplus system properly. Qt: Untested Windows version 10.0 detected! log4cplus:ERROR No appenders could be found for logger (AdSyncNamespace). log4cplus:ERROR Please initialize the log4cplus system properly. Qt: Untested Windows version 10.0 detected! log4cplus:ERROR No appenders could be found for logger (AdSyncNamespace). log4cplus:ERROR Please initialize the log4cplus system properly. Qt: Untested Windows version 10.0 detected! log4cplus:ERROR No appenders could be found for logger (AdSyncNamespace). log4cplus:ERROR Please initialize the log4cplus system properly. Qt: Untested Windows version 10.0 detected! log4cplus:ERROR No appenders could be found for logger (AdSyncNamespace). log4cplus:ERROR Please initialize the log4cplus system properly. Qt: Untested Windows version 10.0 detected! log4cplus:ERROR No appenders could be found for logger (AdSyncNamespace). log4cplus:ERROR Please initialize the log4cplus system properly. Qt: Untested Windows version 10.0 detected! log4cplus:ERROR No appenders could be found for logger (AdSyncNamespace). log4cplus:ERROR Please initialize the log4cplus system properly. Qt: Untested Windows version 10.0 detected! log4cplus:ERROR No appenders could be found for logger (AdSyncNamespace). log4cplus:ERROR Please initialize the log4cplus system properly. Qt: Untested Windows version 10.0 detected! log4cplus:ERROR No appenders could be found for logger (AdSyncNamespace). log4cplus:ERROR Please initialize the log4cplus system properly. Qt: Untested Windows version 10.0 detected! log4cplus:ERROR No appenders could be found for logger (AdSyncNamespace). log4cplus:ERROR Please initialize the log4cplus system properly. Qt: Untested Windows version 10.0 detected! log4cplus:ERROR No appenders could be found for logger (AdSyncNamespace). log4cplus:ERROR Please initialize the log4cplus system properly. Qt: Untested Windows version 10.0 detected! log4cplus:ERROR No appenders could be found for logger (AdSyncNamespace). log4cplus:ERROR Please initialize the log4cplus system properly. 进程已结束,退出代码为 0
08-26
你提供的日志信息: ``` Qt: Untested Windows version 10.0 detected! log4cplus:ERROR No appenders could be found for logger (AdSyncNamespace). log4cplus:ERROR Please initialize the log4cplus system properly. ``` 这类信息虽然看起来很多,但**并不代表你的 Python 程序出现了错误**,而是由某些依赖库输出的**警告信息**,特别是与 **Qt 框架** 和 **log4cplus 日志库** 相关的内容。 --- ## 📌 问题分析 ### 1. `Qt: Untested Windows version 10.0 detected!` - **含义**:这是 Qt 框架的警告信息,表示当前运行的 Windows 版本(Windows 10)未在该 Qt 版本发布时经过测试。 - **原因**:可能是你使用的 Qt 版本较旧,而系统是较新的 Windows 10 或 11。 - **影响**:通常不会影响程序运行,只是警告。 ### 2. `log4cplus:ERROR No appenders could be found for logger...` - **含义**:这是来自 `log4cplus` 日志库的警告,表示它没有找到日志输出配置(如控制台、文件等输出方式)。 - **原因**:某些第三方库(如你程序中使用的某个库)使用了 `log4cplus` 来记录日志,但没有配置日志输出方式。 - **影响**:不影响程序功能,只是无法输出日志。 --- ## ✅ 解决方案 ### ✅ 1. 忽略警告(如果程序正常运行) 如果你运行的程序没有崩溃、没有功能异常,这些警告可以**安全忽略**。它们只是来自底层依赖库的调试信息。 --- ### ✅ 2. 隐藏 Qt 警告(可选) 你可以尝试通过设置环境变量来隐藏 Qt 的警告: ```python import os os.environ["QT_LOGGING_RULES"] = "*.debug=false;qt.qpa.*=false" ``` 将这段代码放在你程序的最开始处,可以减少 Qt 输出的调试信息。 --- ### ✅ 3. 配置 log4cplus(如果有权限修改相关库) 如果你能修改使用 `log4cplus` 的库,可以添加一个简单的日志配置: ```cpp #include <log4cplus/logger.h> #include <log4cplus/consoleappender.h> #include <log4cplus/layout.h> void initLog4cplus() { using namespace log4cplus; SharedAppenderPtr appender(new ConsoleAppender()); appender->setName("console"); LayoutSharedPtr layout(new SimpleLayout()); appender->setLayout(layout); Logger::getRootLogger().addAppender(appender); } ``` 但如果你只是使用第三方库,**通常无法修改这些内容**。 --- ## 🧪 示例:如何在 Python 中屏蔽 Qt 警告 如果你使用的是 PyQt 或 PySide(如 `PyQt5`, `PySide2`, `PySide6`),可以在程序启动前添加: ```python import os os.environ["QT_LOGGING_RULES"] = "*.debug=false;qt.qpa.*=false" from PyQt5.QtWidgets import QApplication, QLabel, QWidget, QVBoxLayout app = QApplication([]) window = QWidget() layout = QVBoxLayout() layout.addWidget(QLabel("Hello, Qt!")) window.setLayout(layout) window.show() app.exec_() ``` 这样可以减少不必要的 Qt 控制台输出。 --- ## ✅ 总结 | 信息 | 是否影响程序 | 是否可忽略 | 是否可修复 | |------|----------------|----------------|----------------| | `Qt: Untested Windows version 10.0 detected!` | ❌ 否 | ✅ 是 | ✅ 是(设置环境变量) | | `log4cplus:ERROR No appenders could be found...` | ❌ 否 | ✅ 是 | ⚠️ 有条件修复(需改库) | --- ##
评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值