Qt/PyQt5等QFileDialog打开文件错误提示log4cplus:ERROR
QFileDialog打开文件错误提示log4cplus:ERROR
PyQt5示例代码
from PyQt5.QtWidgets import QFileDialog, QApplication,QPushButton,QMainWindow
import sys
class QMWXXXX(QMainWindow):
def __init__(self):
super(self.__class__, self).__init__()
bt = QPushButton('getfile')
self.setCentralWidget(bt)
bt.clicked.connect(self.getfile)
def getfile(self, clicked=False):
name, ok = QFileDialog.getOpenFileName(self, 'open xxxxx')
if ok:
print(name)
app = QApplication(sys.argv)
mw = QMWXXXX()
mw.show()
sys.exit(app.exec_())
错误日志信息
错误日志如下,不影响功能,但是影响心情!
log4cplus:ERROR No appenders could be found for logger (AdSyncNamespace).
log4cplus:ERROR Please initialize the log4cplus system properly.
log4cplus:ERROR No appenders could be found for logger (AdSyncNamespace).
log4cplus:ERROR Please initialize the log4cplus system properly.
log4cplus:ERROR No appenders could be found for logger (AdSyncNamespace).
log4cplus:ERROR Please initialize the log4cplus system properly.
log4cplus:ERROR No appenders could be found for logger (AdSyncNamespace).
log4cplus:ERROR Please initialize the log4cplus system properly.
log4cplus:ERROR No appenders could be found for logger (AdSyncNamespace).
log4cplus:ERROR Please initialize the log4cplus system properly.
log4cplus:ERROR No appenders could be found for logger (AdSyncNamespace).
log4cplus:ERROR Please initialize the log4cplus system properly.
log4cplus:ERROR No appenders could be found for logger (AdSyncNamespace).
log4cplus:ERROR Please initialize the log4cplus system properly.
log4cplus:ERROR No appenders could be found for logger (AdSyncNamespace).
log4cplus:ERROR Please initialize the log4cplus system properly.
可能原因
- Autodesk 360问题: 在Autodesk安装目录下的Autodesk Sync目录下,有 AdSyncNamespace.dll,还有 QtGui_Ad_4.dll, QJson.dll,QtXml_Ad_4.dll 等以Qt开头的dll,可能QT会寻找这些动态链接库。
解决途径
- 如果安装了Autodesk360,修改 AdSyncNamespace.dll 名称为 AdSyncNamespace.dll.bak等,可抑制上述错误提示
- 如果未安装Autodesk360,建议安装everything查找本机所有 AdSyncNamespace.* ,并重命名
其他
下载了Qt源码:qt-everywhere-src-5.14.2.zip源码 ,用Xsearch检索源码未发现一下关键字:
- AdSync
- log4cplus
用 Notepad++ 打开 Autodesk360 的 AdSyncNamespace.dll ,检索发现8处log4cplus:
- isEnabledFor@Logger@log4cplus@@QEBA_NH@Z
- forcedLog@Logger@log4cplus@@QEBAXHAEBV
- 1Logger@log4cplus@@UEAA@XZ
- getInstance@Logger@log4cplus@@SA
- Log4CPlusU_Ad_SyncNs_1.dll
- 4Logger@log4cplus@@QEAAAEAV01@AEBV01@@Z
- 0Logger@log4cplus@@QEAA@XZ
- 0LogFinally@SyncFolderManagerLib@Autodesk@@QEAA@PEAVLogger@log4cplus@@VQString@@H@Z