7a2b19
commit 4c913b68d8f8a79e11e247a8f7086f779f2685d4
7a2b19
Author: Tomas Korbar <tkorbar@redhat.com>
7a2b19
Date:   Tue Sep 18 16:17:06 2018 +0200
7a2b19
7a2b19
    Fix TypeError
7a2b19
    
7a2b19
    - 1564770 - TypeError: 'Error' object does not support indexing
7a2b19
7a2b19
diff --git a/clean.py b/clean.py
7a2b19
index 3d41f04..3a7248e 100755
7a2b19
--- a/clean.py
7a2b19
+++ b/clean.py
7a2b19
@@ -182,7 +182,7 @@ try:
7a2b19
                         log.error("Cleaning not needed or supported on this device.")
7a2b19
 
7a2b19
                 except Error as e:
7a2b19
-                    log.error("An error occured: %s" % e[0])
7a2b19
+                    log.error("An error occured: %s" % e.msg)
7a2b19
 
7a2b19
             else:
7a2b19
                 log.error("Device is busy or in an error state. Please check device and try again.")
7a2b19
diff --git a/ui/scrollunload.py b/ui/scrollunload.py
7a2b19
index fdb48e8..345ed82 100644
7a2b19
--- a/ui/scrollunload.py
7a2b19
+++ b/ui/scrollunload.py
7a2b19
@@ -120,7 +120,7 @@ class ScrollUnloadView(ScrollView):
7a2b19
                 self.pc = photocard.PhotoCard(None, self.cur_device.device_uri, self.cur_printer)
7a2b19
             except Error as e:
7a2b19
                 QApplication.restoreOverrideCursor()
7a2b19
-                self.form.FailureUI(self.__tr("An error occured: %s" % e[0]))
7a2b19
+                self.form.FailureUI(self.__tr("An error occured: %s" % e.msg))
7a2b19
                 self.cleanup(EVENT_PCARD_UNABLE_TO_MOUNT)
7a2b19
                 return False
7a2b19
 
7a2b19
diff --git a/ui4/wifisetupdialog.py b/ui4/wifisetupdialog.py
7a2b19
index 9fd1786..4d36f83 100644
7a2b19
--- a/ui4/wifisetupdialog.py
7a2b19
+++ b/ui4/wifisetupdialog.py
7a2b19
@@ -256,7 +256,7 @@ class WifiSetupDialog(QDialog, Ui_Dialog):
7a2b19
             try:
7a2b19
                 self.dev = device.Device(self.device_uri)
7a2b19
             except Error as e:
7a2b19
-                FailureUI(self, self.__tr("Error opening device:

%s

(%s)

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

%s

(%s)

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

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

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

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

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

%s

(%s)

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

%s

(%s)

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

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

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

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

(%s)" % str(e.msg)))
7a2b19
 
7a2b19
         if self.dev is not None:
7a2b19
             self.dev.close()