diff --git a/openlp/plugins/presentations/lib/pdfcontroller.py b/openlp/plugins/presentations/lib/pdfcontroller.py index e1d0dc8f0..941be3fe1 100644 --- a/openlp/plugins/presentations/lib/pdfcontroller.py +++ b/openlp/plugins/presentations/lib/pdfcontroller.py @@ -31,6 +31,7 @@ import os import logging from tempfile import NamedTemporaryFile import re +import shutil from subprocess import check_output, CalledProcessError, STDOUT from openlp.core.utils import AppLocation @@ -144,17 +145,10 @@ class PdfController(PresentationController): else: DEVNULL = open(os.devnull, 'wb') # First try to find mupdf - try: - self.mudrawbin = check_output(['which', 'mudraw'], - stderr=DEVNULL).decode(encoding='UTF-8').rstrip('\n') - except CalledProcessError: - self.mudrawbin = '' + self.mudrawbin = shutil.which('mudraw') # if mupdf isn't installed, fallback to ghostscript if not self.mudrawbin: - try: - self.gsbin = check_output(['which', 'gs'], stderr=DEVNULL).decode(encoding='UTF-8').rstrip('\n') - except CalledProcessError: - self.gsbin = '' + self.gsbin = shutil.which('gs') # Last option: check if mudraw is placed in OpenLP base folder if not self.mudrawbin and not self.gsbin: application_path = AppLocation.get_directory(AppLocation.AppDir)