tabula.exe 路径在 pyqt5 中没有打开

tabula.exe path does not open in pyqt5

我在 pyqt5 中指定了 tabula.exe 的路径,当我 运行 代码只有 cmd 闪烁一秒钟并且 closes.I 尝试了以下

 def openUrl(self):
      url = QtCore.QUrl('C:/Users/DELL/Desktop/Tabula/tabula/tabula.exe')
       if not QtGui.QDesktopServices.openUrl(url):
           QtGui.QMessageBox.warning(self, 'Open Url', 'Could not open url')

当您使用QDesktopServices::openUrl() it is to signal to the OS that it is necessary to open a file and that it is in charge of looking for the application that can do it. In your case it does not comply with that logic, so the solution is to use QProcess::startDetached()时:

tabula_path = 'C:/Users/DELL/Desktop/Tabula/tabula/tabula.exe'
if QtCore.QProcess.startDetached(tabula_path):
    QtWidgets.QMessageBox.information(self, 'Info', 'open a browser and go to http://localhost:8080')
else:
    QtWidgets.QMessageBox.warning(self, 'Problem', 'Problem with tabula')