From 6c89a880dabe33a7e0afce9bad03ae7518a44daf Mon Sep 17 00:00:00 2001 From: Tomas Korbar Date: Sep 18 2018 15:12:20 +0000 Subject: 1564770 - Fix TypeError when printing error object message --- diff --git a/hplip-error-print.patch b/hplip-error-print.patch new file mode 100644 index 0000000..e4b3e5f --- /dev/null +++ b/hplip-error-print.patch @@ -0,0 +1,78 @@ +commit 4c913b68d8f8a79e11e247a8f7086f779f2685d4 +Author: Tomas Korbar +Date: Tue Sep 18 16:17:06 2018 +0200 + + Fix TypeError + + - 1564770 - TypeError: 'Error' object does not support indexing + +diff --git a/clean.py b/clean.py +index 3d41f04..3a7248e 100755 +--- a/clean.py ++++ b/clean.py +@@ -182,7 +182,7 @@ try: + log.error("Cleaning not needed or supported on this device.") + + except Error as e: +- log.error("An error occured: %s" % e[0]) ++ log.error("An error occured: %s" % e.msg) + + else: + log.error("Device is busy or in an error state. Please check device and try again.") +diff --git a/ui/scrollunload.py b/ui/scrollunload.py +index fdb48e8..345ed82 100644 +--- a/ui/scrollunload.py ++++ b/ui/scrollunload.py +@@ -120,7 +120,7 @@ class ScrollUnloadView(ScrollView): + self.pc = photocard.PhotoCard(None, self.cur_device.device_uri, self.cur_printer) + except Error as e: + QApplication.restoreOverrideCursor() +- self.form.FailureUI(self.__tr("An error occured: %s" % e[0])) ++ self.form.FailureUI(self.__tr("An error occured: %s" % e.msg)) + self.cleanup(EVENT_PCARD_UNABLE_TO_MOUNT) + return False + +diff --git a/ui4/wifisetupdialog.py b/ui4/wifisetupdialog.py +index 9fd1786..4d36f83 100644 +--- a/ui4/wifisetupdialog.py ++++ b/ui4/wifisetupdialog.py +@@ -256,7 +256,7 @@ class WifiSetupDialog(QDialog, Ui_Dialog): + try: + self.dev = device.Device(self.device_uri) + except Error as e: +- FailureUI(self, self.__tr("Error opening device:

%s

(%s)

") %(self.device_uri, QString(e[0]))) ++ FailureUI(self, self.__tr("Error opening device:

%s

(%s)

") %(self.device_uri, QString(e.msg))) + + if self.dev is not None: + self.dev.close() +@@ -834,7 +834,7 @@ class WifiSetupDialog(QDialog, Ui_Dialog): + + + def showIOError(self, e): +- FailureUI(self, self.__tr("An I/O error occurred.

Please check the USB connection to your printer and try again.

(%s)" % QString(e[0]))) ++ FailureUI(self, self.__tr("An I/O error occurred.

Please check the USB connection to your printer and try again.

(%s)" % QString(e.msg))) + + if self.dev is not None: + self.dev.close() +diff --git a/ui5/wifisetupdialog.py b/ui5/wifisetupdialog.py +index e0c7aee..74cc0ef 100644 +--- a/ui5/wifisetupdialog.py ++++ b/ui5/wifisetupdialog.py +@@ -259,7 +259,7 @@ class WifiSetupDialog(QDialog, Ui_Dialog): + try: + self.dev = device.Device(self.device_uri) + except Error as e: +- FailureUI(self, self.__tr("Error opening device:

%s

(%s)

") %(self.device_uri, str(e[0]))) ++ FailureUI(self, self.__tr("Error opening device:

%s

(%s)

") %(self.device_uri, str(e.msg))) + + if self.dev is not None: + self.dev.close() +@@ -840,7 +840,7 @@ class WifiSetupDialog(QDialog, Ui_Dialog): + + + def showIOError(self, e): +- FailureUI(self, self.__tr("An I/O error occurred.

Please check the USB connection to your printer and try again.

(%s)" % str(e[0]))) ++ FailureUI(self, self.__tr("An I/O error occurred.

Please check the USB connection to your printer and try again.

(%s)" % str(e.msg))) + + if self.dev is not None: + self.dev.close() diff --git a/hplip.spec b/hplip.spec index 9ccd430..794b2b4 100644 --- a/hplip.spec +++ b/hplip.spec @@ -7,7 +7,7 @@ Summary: HP Linux Imaging and Printing Project Name: hplip Version: 3.18.6 -Release: 5%{?dist} +Release: 6%{?dist} License: GPLv2+ and MIT and BSD and IJG and Public Domain and GPLv2+ with exceptions and ISC Url: https://developers.hp.com/hp-linux-imaging-and-printing @@ -49,6 +49,7 @@ Patch30: hplip-typo.patch Patch31: hplip-use-binary-str.patch # m278-m281 doesn't work correctly again Patch32: hplip-colorlaserjet-mfp-m278-m281.patch +Patch33: hplip-error-print.patch Requires: %{name}-libs%{?_isa} = %{version}-%{release} Requires: python3-pillow @@ -252,6 +253,9 @@ rm prnt/hpcups/ErnieFilter.{cpp,h} prnt/hpijs/ernieplatform.h %patch31 -p1 -b .use-binary-str %patch32 -p1 -b .colorlaserjet-mfp-m278-m281 +# TypeError: 'Error' object does not support indexing (bug #1564770) +%patch33 -p1 -b .error-print-fix + sed -i.duplex-constraints \ -e 's,\(UIConstraints.* \*Duplex\),//\1,' \ prnt/drv/hpcups.drv.in @@ -537,6 +541,9 @@ rm -f %{buildroot}%{_sysconfdir}/xdg/autostart/hplip-systray.desktop %config(noreplace) %{_sysconfdir}/sane.d/dll.d/hpaio %changelog +* Tue Sep 18 2018 Tomas Korbar - 3.18.6-6 +- 1564770 - Fix TypeError when printing error object message + * Tue Jul 24 2018 Zdenek Dohnal - 3.18.6-5 - correcting license