Index: src/sas/sasgui/perspectives/invariant/__init__.py
===================================================================
--- src/sas/sasgui/perspectives/invariant/__init__.py	(revision 5a405bda2da663894b6b32ab94768a91d60525a4)
+++ src/sas/sasgui/perspectives/invariant/__init__.py	(revision fa81e94af983227efded2314c2c544f98e2c56ba)
@@ -3,5 +3,5 @@
 
 from distutils.filelist import findall
-from invariant import *
+from .invariant import *
 
 def get_data_path(media):
Index: src/sas/sasgui/perspectives/invariant/invariant.py
===================================================================
--- src/sas/sasgui/perspectives/invariant/invariant.py	(revision 7432acb919f4013119ca918a73350297e0d4c93f)
+++ src/sas/sasgui/perspectives/invariant/invariant.py	(revision fa81e94af983227efded2314c2c544f98e2c56ba)
@@ -133,5 +133,5 @@
             name = data.__class__.__name__
             msg = "Invariant use only Data1D got: [%s] " % str(name)
-            raise ValueError, msg
+            raise ValueError(msg)
         self.compute_helper(data=data)
 
@@ -169,5 +169,5 @@
                 msg += "Please select one.\n"
                 if len(data_list) > 1:
-                    from invariant_widgets import DataDialog
+                    from .invariant_widgets import DataDialog
                     dlg = DataDialog(data_list=data_1d_list, text=msg)
                     if dlg.ShowModal() == wx.ID_OK:
@@ -191,5 +191,5 @@
                     self.compute_helper(data)
                 except:
-                    msg = "Invariant Set_data: " + str(sys.exc_value)
+                    msg = "Invariant Set_data: " + str(sys.exc_info()[1])
                     wx.PostEvent(self.parent, StatusEvent(status=msg, info="error"))
         else:
@@ -240,5 +240,5 @@
             msg = "invariant.save_file: the data being saved is"
             msg += " not a sas.sascalc.dataloader.data_info.Data1D object"
-            raise RuntimeError, msg
+            raise RuntimeError(msg)
 
     def set_state(self, state=None, datainfo=None):
@@ -258,5 +258,5 @@
                 msg = "invariant.set_state: datainfo parameter cannot"
                 msg += " be None in standalone mode"
-                raise RuntimeError, msg
+                raise RuntimeError(msg)
             # Make sure the user sees the invariant panel after loading
             # self.parent.set_perspective(self.perspective)
@@ -282,5 +282,5 @@
 
         except:
-            logger.error("invariant.set_state: %s" % sys.exc_value)
+            logger.error("invariant.set_state: %s" % sys.exc_info()[1])
 
     def on_set_state_helper(self, event=None):
@@ -320,5 +320,5 @@
         else:
             msg = "Scale can not be zero."
-            raise ValueError, msg
+            raise ValueError(msg)
         if len(new_plot.x) == 0:
             return
Index: src/sas/sasgui/perspectives/invariant/invariant_details.py
===================================================================
--- src/sas/sasgui/perspectives/invariant/invariant_details.py	(revision 959eb0181ad06828a748f04512f953aad5b31659)
+++ src/sas/sasgui/perspectives/invariant/invariant_details.py	(revision fa81e94af983227efded2314c2c544f98e2c56ba)
@@ -6,5 +6,5 @@
 
 from sas.sasgui.guiframe.utils import format_number
-from invariant_widgets import OutputTextCtrl
+from .invariant_widgets import OutputTextCtrl
 # Dimensions related to chart
 RECTANGLE_WIDTH = 400.0
Index: src/sas/sasgui/perspectives/invariant/invariant_panel.py
===================================================================
--- src/sas/sasgui/perspectives/invariant/invariant_panel.py	(revision 7432acb919f4013119ca918a73350297e0d4c93f)
+++ src/sas/sasgui/perspectives/invariant/invariant_panel.py	(revision fa81e94af983227efded2314c2c544f98e2c56ba)
@@ -318,10 +318,10 @@
         background = self.background_tcl.GetValue().lstrip().rstrip()
         if background == "":
-            raise ValueError, "Need a background"
+            raise ValueError("Need a background")
         if check_float(self.background_tcl):
             return float(background)
         else:
             msg = "Receive invalid value for background : %s" % (background)
-            raise ValueError, msg
+            raise ValueError(msg)
 
     def get_scale(self):
@@ -331,5 +331,5 @@
         scale = self.scale_tcl.GetValue().lstrip().rstrip()
         if scale == "":
-            raise ValueError, "Need a background"
+            raise ValueError("Need a background")
         if check_float(self.scale_tcl):
             if float(scale) <= 0.0:
@@ -337,8 +337,8 @@
                 self.scale_tcl.Refresh()
                 msg = "Receive invalid value for scale: %s" % (scale)
-                raise ValueError, msg
+                raise ValueError(msg)
             return float(scale)
         else:
-            raise ValueError, "Receive invalid value for scale : %s" % (scale)
+            raise ValueError("Receive invalid value for scale : %s" % (scale))
 
     def get_contrast(self):
@@ -389,5 +389,5 @@
                 self.volume_err_tcl.SetValue(format_number(None))
                 msg = "Error occurred computing volume "
-                msg += " fraction: %s" % sys.exc_value
+                msg += " fraction: %s" % sys.exc_info()[1]
                 wx.PostEvent(self.parent, StatusEvent(status=msg,
                                                       info="error",
@@ -409,5 +409,5 @@
                 self.surface_err_tcl.SetValue(format_number(None))
                 msg = "Error occurred computing "
-                msg += "specific surface: %s" % sys.exc_value
+                msg += "specific surface: %s" % sys.exc_info()[1]
                 wx.PostEvent(self.parent, StatusEvent(status=msg, info="error",
                                                       type="stop"))
@@ -431,5 +431,5 @@
             self.invariant_total_err_tcl.SetValue(format_number(None))
             msg = "Error occurred computing invariant using"
-            msg += " extrapolation: %s" % sys.exc_value
+            msg += " extrapolation: %s" % sys.exc_info()[1]
             wx.PostEvent(self.parent, StatusEvent(status=msg, type="stop"))
 
@@ -454,5 +454,5 @@
                 self._manager.plot_theory(name="Low-Q extrapolation")
                 msg = "Error occurred computing low-Q "
-                msg += "invariant: %s" % sys.exc_value
+                msg += "invariant: %s" % sys.exc_info()[1]
                 wx.PostEvent(self.parent,
                              StatusEvent(status=msg, type="stop"))
@@ -462,5 +462,5 @@
                 self._manager.plot_theory(name="Low-Q extrapolation")
             except:
-                logger.error(sys.exc_value)
+                logger.error(sys.exc_info()[1])
 
     def get_high_qstar(self, inv, high_q=False):
@@ -488,5 +488,5 @@
                 self._manager.plot_theory(name="High-Q extrapolation")
                 msg = "Error occurred computing high-Q "
-                msg += "invariant: %s" % sys.exc_value
+                msg += "invariant: %s" % sys.exc_info()[1]
                 wx.PostEvent(self.parent, StatusEvent(status=msg,
                                                       type="stop"))
@@ -496,5 +496,5 @@
                 self._manager.plot_theory(name="High-Q extrapolation")
             except:
-                logger.error(sys.exc_value)
+                logger.error(sys.exc_info()[1])
 
     def get_qstar(self, inv):
@@ -625,5 +625,5 @@
             scale = self.get_scale()
         except:
-            msg = "Invariant Error: %s" % (sys.exc_value)
+            msg = "Invariant Error: %s" % (sys.exc_info()[1])
             wx.PostEvent(self.parent, StatusEvent(status=msg, type="stop"))
             return
@@ -641,5 +641,5 @@
             inv, npts_high = self.set_extrapolation_high(inv=inv, high_q=high_q)
         except:
-            msg = "Error occurred computing invariant: %s" % sys.exc_value
+            msg = "Error occurred computing invariant: %s" % sys.exc_info()[1]
             wx.PostEvent(self.parent, StatusEvent(status=msg,
                                                   info="warning", type="stop"))
@@ -652,5 +652,5 @@
             self.get_qstar(inv=inv)
         except:
-            msg = "Error occurred computing invariant: %s" % sys.exc_value
+            msg = "Error occurred computing invariant: %s" % sys.exc_info()[1]
             wx.PostEvent(self.parent, StatusEvent(status=msg,
                                                   info="warning",
@@ -675,5 +675,5 @@
         except:
             msg = r_msg + "Error occurred computing invariant: %s" % \
-                                                            sys.exc_value
+                                                            sys.exc_info()[1]
             wx.PostEvent(self.parent, StatusEvent(status=msg,
                                                   info="error",
@@ -685,5 +685,5 @@
             #compute surface and set value to txtcrtl
         except:
-            msg = "Error occurred computing invariant: %s" % sys.exc_value
+            msg = "Error occurred computing invariant: %s" % sys.exc_info()[1]
             wx.PostEvent(self.parent, StatusEvent(status=msg,
                                                   info="warning",
@@ -695,5 +695,5 @@
 
         except:
-            msg = "Error occurred computing invariant: %s" % sys.exc_value
+            msg = "Error occurred computing invariant: %s" % sys.exc_info()[1]
             wx.PostEvent(self.parent, StatusEvent(status=msg,
                                                   info="warning",
@@ -847,5 +847,5 @@
             attr.SetValue(value)
         except:
-            logger.error("Invariant state: %s", sys.exc_value)
+            logger.error("Invariant state: %s", sys.exc_info()[1])
 
     def get_bookmark_by_num(self, num=None):
@@ -864,6 +864,6 @@
             _, _, current_state, comp_state = self.state.bookmark_list[int(num)]
         except:
-            logger.error(sys.exc_value)
-            raise ValueError, "No such bookmark exists"
+            logger.error(sys.exc_info()[1])
+            raise ValueError("No such bookmark exists")
 
         # set the parameters
@@ -959,5 +959,5 @@
                     self.state.clone_state()
         except:
-            logger.error(sys.exc_value)
+            logger.error(sys.exc_info()[1])
 
         self._set_undo_flag(True)
@@ -1003,5 +1003,5 @@
                 del self.state.state_list[str(i)]
             except:
-                logger.error(sys.exc_value)
+                logger.error(sys.exc_info()[1])
         # Enable the undo button if it was not
         self._set_undo_flag(True)
@@ -1068,5 +1068,5 @@
                 del self.state.state_list[str(i)]
             except:
-                logger.error(sys.exc_value)
+                logger.error(sys.exc_info()[1])
 
         # try to add new state of the text changes in the state_list
@@ -1083,5 +1083,5 @@
             self.state.state_list[str(self.state.state_num)] = self.state.clone_state()
         except:
-            logger.error(sys.exc_value)
+            logger.error(sys.exc_info()[1])
 
         self._set_undo_flag(True)
@@ -1105,5 +1105,5 @@
             self.state.state_list[str(self.state.state_num)] = self.state.clone_state()
         except:
-            logger.error(sys.exc_value)
+            logger.error(sys.exc_info()[1])
 
     def _get_input_list(self):
@@ -1114,6 +1114,6 @@
         compute_num = self.state.saved_state['compute_num']
         # find values and put into the input list
-        for key1, value1 in self.state.state_list[str(compute_num)].iteritems():
-            for key, _ in self.state.input_list.iteritems():
+        for key1, value1 in self.state.state_list[str(compute_num)].items():
+            for key, _ in self.state.input_list.items():
                 if key == key1:
                     self.state.input_list[key] = value1
Index: src/sas/sasgui/perspectives/invariant/invariant_state.py
===================================================================
--- src/sas/sasgui/perspectives/invariant/invariant_state.py	(revision 1fa4f7368e26981352615cbfb337a581ed97031f)
+++ src/sas/sasgui/perspectives/invariant/invariant_state.py	(revision fa81e94af983227efded2314c2c544f98e2c56ba)
@@ -137,5 +137,5 @@
 
         # text ctl general inputs ( excluding extrapolation text ctl)
-        for key, value in self.input_list.iteritems():
+        for key, value in self.input_list.items():
             if value == '':
                 continue
@@ -163,5 +163,5 @@
         low_off = False
         high_off = False
-        for key, value in self.input_list.iteritems():
+        for key, value in self.input_list.items():
             key_split = key.split('_')
             max_ind = len(key_split) - 1
@@ -213,5 +213,5 @@
                 # other outputs than Q*
                 name = item[0] + "_tcl"
-                if name in self.saved_state.keys():
+                if name in list(self.saved_state.keys()):
                     value = self.saved_state[name]
 
@@ -298,5 +298,5 @@
         top_element.appendChild(state)
 
-        for name, value in self.saved_state.iteritems():
+        for name, value in self.saved_state.items():
             element = newdoc.createElement(str(name))
             element.appendChild(newdoc.createTextNode(str(value)))
@@ -307,7 +307,7 @@
         top_element.appendChild(history)
 
-        for name, value in self.state_list.iteritems():
+        for name, value in self.state_list.items():
             history_element = newdoc.createElement('state_' + str(name))
-            for state_name, state_value in value.iteritems():
+            for state_name, state_value in value.items():
                 state_element = newdoc.createElement(str(state_name))
                 child = newdoc.createTextNode(str(state_value))
@@ -322,5 +322,5 @@
         top_element.appendChild(bookmark)
         item_list = ['time', 'date', 'state', 'comp_state']
-        for name, value_list in self.bookmark_list.iteritems():
+        for name, value_list in self.bookmark_list.items():
             element = newdoc.createElement('mark_' + str(name))
             _, date, state, comp_state = value_list
@@ -331,10 +331,10 @@
             state_list_element = newdoc.createElement('state')
             comp_state_list_element = newdoc.createElement('comp_state')
-            for state_name, state_value in value_list[2].iteritems():
+            for state_name, state_value in value_list[2].items():
                 state_element = newdoc.createElement(str(state_name))
                 child = newdoc.createTextNode(str(state_value))
                 state_element.appendChild(child)
                 state_list_element.appendChild(state_element)
-            for comp_name, comp_value in value_list[3].iteritems():
+            for comp_name, comp_value in value_list[3].items():
                 comp_element = newdoc.createElement(str(comp_name))
                 comp_element.appendChild(newdoc.createTextNode(str(comp_value)))
@@ -365,5 +365,5 @@
             msg = "InvariantSate no longer supports non-CanSAS"
             msg += " format for invariant files"
-            raise RuntimeError, msg
+            raise RuntimeError(msg)
 
         if node.get('version')\
@@ -382,5 +382,5 @@
                 except:
                     msg = "InvariantSate.fromXML: Could not read"
-                    msg += " timestamp\n %s" % sys.exc_value
+                    msg += " timestamp\n %s" % sys.exc_info()[1]
                     logger.error(msg)
 
@@ -454,5 +454,5 @@
         # default string values
         for num in range(1, 19):
-            exec "s_%s = 'NA'" % str(num)
+            exec("s_%s = 'NA'" % str(num))
         lines = strings.split('\n')
         # get all string values from __str__()
@@ -695,5 +695,5 @@
         except:
             msg = "XML document does not contain invariant"
-            msg += " information.\n %s" % sys.exc_value
+            msg += " information.\n %s" % sys.exc_info()[1]
             logger.info(msg)
         return state
@@ -737,5 +737,5 @@
                         output.append(sas_entry)
         else:
-            raise RuntimeError, "%s is not a file" % path
+            raise RuntimeError("%s is not a file" % path)
 
         # Return output consistent with the loader's api
@@ -783,5 +783,5 @@
             msg = "The cansas writer expects a Data1D"
             msg += " instance: %s" % str(datainfo.__class__.__name__)
-            raise RuntimeError, msg
+            raise RuntimeError(msg)
         # make sure title and data run is filled up.
         if datainfo.title is None or datainfo.title == '':
Index: src/sas/sasgui/perspectives/invariant/report_dialog.py
===================================================================
--- src/sas/sasgui/perspectives/invariant/report_dialog.py	(revision 959eb0181ad06828a748f04512f953aad5b31659)
+++ src/sas/sasgui/perspectives/invariant/report_dialog.py	(revision fa81e94af983227efded2314c2c544f98e2c56ba)
@@ -94,5 +94,5 @@
                     except:
                         # DO not open
-                        logger.error("Could not open file: %s" % sys.exc_value)
+                        logger.error("Could not open file: %s" % sys.exc_info()[1])
             # delete image file
             os.remove(pic_fname)
