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 == '':
