File: 0062-Fix-TypeError.patch

package info (click to toggle)
hplip 3.22.10%2Bdfsg0-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 171,296 kB
  • sloc: python: 83,373; ansic: 71,016; cpp: 65,202; sh: 4,408; perl: 4,397; makefile: 937
file content (84 lines) | stat: -rw-r--r-- 3,820 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
From: Tomas Korbar <tkorbar@redhat.com>
Date: Fri, 31 Jan 2020 13:29:31 +0100
Subject: Fix TypeError

- 1564770 - TypeError: 'Error' object does not support indexing

Origin: https://src.fedoraproject.org/rpms/hplip/blob/master/f/hplip-error-print.patch
---
 clean.py               | 2 +-
 ui/scrollunload.py     | 2 +-
 ui4/wifisetupdialog.py | 4 ++--
 ui5/wifisetupdialog.py | 4 ++--
 4 files changed, 6 insertions(+), 6 deletions(-)

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 4beb2e9..19b2ce5 100644
--- a/ui4/wifisetupdialog.py
+++ b/ui4/wifisetupdialog.py
@@ -250,7 +250,7 @@ class WifiSetupDialog(QDialog, Ui_Dialog):
             try:
                 self.dev = device.Device(self.device_uri)
             except Error as e:
-                FailureUI(self, self.__tr("<b>Error opening device:</b><p>%s</p><p>(%s)</p>") %(self.device_uri, QString(e[0])))
+                FailureUI(self, self.__tr("<b>Error opening device:</b><p>%s</p><p>(%s)</p>") %(self.device_uri, QString(e.msg)))
 
                 if self.dev is not None:
                     self.dev.close()
@@ -828,7 +828,7 @@ class WifiSetupDialog(QDialog, Ui_Dialog):
 
 
     def showIOError(self, e):
-        FailureUI(self, self.__tr("<b>An I/O error occurred.</b><p>Please check the USB connection to your printer and try again.</p>(%s)" % QString(e[0])))
+        FailureUI(self, self.__tr("<b>An I/O error occurred.</b><p>Please check the USB connection to your printer and try again.</p>(%s)" % QString(e.msg)))
 
         if self.dev is not None:
             self.dev.close()
diff --git a/ui5/wifisetupdialog.py b/ui5/wifisetupdialog.py
index 7fde180..e735650 100644
--- a/ui5/wifisetupdialog.py
+++ b/ui5/wifisetupdialog.py
@@ -253,7 +253,7 @@ class WifiSetupDialog(QDialog, Ui_Dialog):
             try:
                 self.dev = device.Device(self.device_uri)
             except Error as e:
-                FailureUI(self, self.__tr("<b>Error opening device:</b><p>%s</p><p>(%s)</p>") %(self.device_uri, str(e)))
+                FailureUI(self, self.__tr("<b>Error opening device:</b><p>%s</p><p>(%s)</p>") %(self.device_uri, str(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("<b>An I/O error occurred.</b><p>Please check the USB connection to your printer and try again.</p>(%s)" % str(e)))
+        FailureUI(self, self.__tr("<b>An I/O error occurred.</b><p>Please check the USB connection to your printer and try again.</p>(%s)" % str(e.msg)))
 
         if self.dev is not None:
             self.dev.close()