【发布时间】:2017-03-12 13:12:10
【问题描述】:
我正在尝试使用 QDesktopServices 让系统打开指定的文件或文件夹。
下面的代码非常适用于其中没有空格但如果没有空格则无法执行的路径
def openFile(self):
print self.oVidPath
print "\n"
url = QUrl(self.oVidPath)
QDesktopServices.openUrl(url)
self.Dialog.close()
带有空格的路径的输出是
/home/kerneldev/Documents/Why alcohol doesn't come with nutrition facts.mp4
gvfs-open: /home/kerneldev/Documents/Why%20alcohol%20doesn't%20come%20with%20nutrition%20facts.mp4: error opening location: Error when getting information for file '/home/kerneldev/Documents/Why%20alcohol%20doesn't%20come%20with%20nutrition%20facts.mp4': No such file or directory
我已验证指定的路径存在。
请帮忙
【问题讨论】:
标签: python pyqt pyqt5 qurl qdesktopservices