From a2c45f8e59d0db60c8198bbe9f35cd864ba54de6 Mon Sep 17 00:00:00 2001 From: Johnny Zhang Date: Mon, 30 Mar 2020 11:38:07 +0800 Subject: [PATCH] Added Python version check --- eaf.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/eaf.py b/eaf.py index 763cd19..c693d0b 100755 --- a/eaf.py +++ b/eaf.py @@ -23,6 +23,7 @@ # QtWebEngine will throw error "ImportError: QtWebEngineWidgets must be imported before a QCoreApplication instance is created" # So we import browser module before start Qt application instance to avoid this error, but we never use this module. from app.browser.buffer import AppBuffer as NeverUsed # noqa +from sys import version_info from PyQt5.QtCore import QLibraryInfo from PyQt5.QtNetwork import QNetworkProxy @@ -36,6 +37,7 @@ import json import os import subprocess + EAF_DBUS_NAME = "com.lazycat.eaf" EAF_OBJECT_NAME = "/com/lazycat/eaf" @@ -80,7 +82,10 @@ class EAF(dbus.service.Object): def webengine_include_private_codec(self): path = os.path.join(QLibraryInfo.location(QLibraryInfo.LibraryExecutablesPath), "QtWebEngineProcess") - result = subprocess.run("ldd {} | grep libavformat".format(path), shell=True, stdout=subprocess.PIPE, text=True) + if version_info > (3,7): + result = subprocess.run("ldd {} | grep libavformat".format(path), check=False, shell=True, stdout=subprocess.PIPE, text=True) + else: + result = subprocess.run("ldd {} | grep libavformat".format(path), check=False, shell=True, stdout=subprocess.PIPE) return result.stdout != "" @dbus.service.method(EAF_DBUS_NAME, in_signature="s", out_signature="")