From b2ee256aec46767cf8d906d06feb10963287f9fc Mon Sep 17 00:00:00 2001 From: "Justin D. Kendall" Date: Tue, 30 Jan 2018 23:14:41 +0000 Subject: [PATCH] Include error message in raised message on import --- Source/AboutDialog.py | 4 ++-- Source/CameraUtils.py | 4 ++-- Source/CreateScript.py | 4 ++-- Source/PiCameraApp.py | 8 ++++---- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Source/AboutDialog.py b/Source/AboutDialog.py index 5107e74..442fa21 100644 --- a/Source/AboutDialog.py +++ b/Source/AboutDialog.py @@ -30,8 +30,8 @@ NoRequire = False try: from pkg_resources import require -except ImportError: - print "Cannot import 'require' from 'pkg_resources'" +except ImportError as imp_err: + print "Cannot import 'require' from 'pkg_resources':\n {0}".format(imp_err) NoRequire = True from NotePage import BasicNotepage diff --git a/Source/CameraUtils.py b/Source/CameraUtils.py index a1cca6c..6bdb4d4 100644 --- a/Source/CameraUtils.py +++ b/Source/CameraUtils.py @@ -28,8 +28,8 @@ try: import PIL from PIL import Image, ImageTk, ExifTags -except ImportError: - raise ImportError("You do not seem to have the Python Imaging Library (PIL) installed") +except ImportError as imp_err: + raise ImportError("You do not seem to have the Python Imaging Library (PIL) installed:\n {0}".format(imp_err)) from Utils import OnOff, EvenOdd diff --git a/Source/CreateScript.py b/Source/CreateScript.py index 7d81efa..f971a79 100644 --- a/Source/CreateScript.py +++ b/Source/CreateScript.py @@ -3,8 +3,8 @@ import picamera from picamera import * import picamera.array -except ImportError: - raise ImportError("You do not seem to have PiCamera installed") +except ImportError as imp_err: + raise ImportError("You do not seem to have PiCamera installed:\n {0}".format(imp_err)) PiCameraLoaded = False def OutputPythonScript ( camera ): diff --git a/Source/PiCameraApp.py b/Source/PiCameraApp.py index 07bd140..3805d74 100644 --- a/Source/PiCameraApp.py +++ b/Source/PiCameraApp.py @@ -38,8 +38,8 @@ import picamera from picamera import * import picamera.array -except ImportError: - raise ImportError("You do not seem to have PiCamera installed") +except ImportError as imp_err: + raise ImportError("You do not seem to have PiCamera installed:\n{0}".format(imp_err)) try: from Tkinter import * @@ -57,8 +57,8 @@ try: import PIL from PIL import Image, ImageTk, ExifTags -except ImportError: - raise ImportError("You do not seem to have the Python Imaging Library (PIL) installed") +except ImportError as imp_err: + raise ImportError("You do not seem to have the Python Imaging Library (PIL) installed:\n{0}".format(imp_err)) from AboutDialog import * from PreferencesDialog import *