Index: src/sas/sasgui/perspectives/fitting/basepage.py
===================================================================
--- src/sas/sasgui/perspectives/fitting/basepage.py	(revision cb4ef58d8aabd8393aae14823d3fa98d1ba0c1a2)
+++ src/sas/sasgui/perspectives/fitting/basepage.py	(revision 7673ecd9d5adcefdfa1fc6a6d1ff0649f8e63bc8)
@@ -12,6 +12,10 @@
 import json
 import logging
+import traceback
+
 from collections import defaultdict
 from wx.lib.scrolledpanel import ScrolledPanel
+
+import sasmodels.sasview_model
 from sas.sasgui.guiframe.panel_base import PanelBase
 from sas.sasgui.guiframe.utils import format_number, check_float, IdList
@@ -852,7 +856,7 @@
                     angles.append(angle)
                     weights.append(weight)
-                except:
+                except Exception:
                     # Skip non-data lines
-                    logging.error(sys.exc_info()[1])
+                    logging.error(traceback.format_exc())
             return numpy.array(angles), numpy.array(weights)
         except:
@@ -1393,6 +1397,6 @@
                 self.model._persistency_dict[key] = \
                                  [state.values, state.weights]
-            except:
-                logging.error(sys.exc_info()[1])
+            except Exception:
+                logging.error(traceback.format_exc())
             selection = self._find_polyfunc_selection(disp_model)
             for list in self.fittable_param:
@@ -1410,6 +1414,6 @@
                             list[5].Disable()
                             list[6].Disable()
-                        except:
-                            logging.error(sys.exc_info()[1])
+                        except Exception:
+                            logging.error(traceback.format_exc())
             # For array, disable all fixed params
             if selection == 1:
@@ -1419,6 +1423,6 @@
                         try:
                             item[2].Disable()
-                        except:
-                            logging.error(sys.exc_info()[1])
+                        except Exception:
+                            logging.error(traceback.format_exc())
 
         # Make sure the check box updated when all checked
@@ -1507,6 +1511,6 @@
                 is_modified = self._check_value_enter(self.parameters,
                                                       is_modified)
-            except:
-                logging.error(sys.exc_info()[1])
+            except Exception:
+                logging.error(traceback.format_exc())
 
             # Here we should check whether the boundaries have been modified.
@@ -1651,6 +1655,6 @@
         try:
             self.save_current_state()
-        except:
-            logging.error(sys.exc_info()[1])
+        except Exception:
+            logging.error(traceback.format_exc())
 
         return flag
@@ -1895,9 +1899,5 @@
             if mod_cat == custom_model:
                 for model in self.model_list_box[mod_cat]:
-                    if 'sasmodels.sasview_model.' in str(model):
-                        str_m = model.id
-                    else:
-                        str_m = str(model).split(".")[0]
-                    #self.model_box.Append(str_m)
+                    str_m = model.id if hasattr(model, 'id') else model.name
                     m_list.append(self.model_dict[str_m])
             else:
@@ -1910,6 +1910,6 @@
                     #    wx.PostEvent(self.parent.parent,
                     #                 StatusEvent(status=msg, info="error"))
-        except:
-            msg = "%s\n" % (sys.exc_info()[1])
+        except Exception:
+            msg = traceback.format_exc()
             wx.PostEvent(self._manager.parent,
                          StatusEvent(status=msg, info="error"))
@@ -2474,6 +2474,6 @@
                 try:
                     self.model.set_dispersion(p, disp_model)
-                except:
-                    logging.error(sys.exc_info()[1])
+                except Exception:
+                    logging.error(traceback.format_exc())
 
         ## save state into
@@ -2687,6 +2687,6 @@
             del self.model._persistency_dict[name.split('.')[0]]
             del self.state.model._persistency_dict[name.split('.')[0]]
-        except:
-            logging.error(sys.exc_info()[1])
+        except Exception:
+            logging.error(traceback.format_exc())
 
     def _lay_out(self):
@@ -2832,7 +2832,7 @@
                         graphs.append(item2.figure)
                         canvases.append(item2.canvas)
-            except:
+            except Exception:
                 # Not for control panels
-                logging.error(sys.exc_info()[1])
+                logging.error(traceback.format_exc())
         # Make sure the resduals plot goes to the last
         if res_item != None:
@@ -3167,6 +3167,6 @@
                 if item[7].__class__.__name__ == 'ComboBox':
                     disfunc = str(item[7].GetValue())
-            except:
-                logging.error(sys.exc_info()[1])
+            except Exception:
+                logging.error(traceback.format_exc())
 
             # 2D
@@ -3174,5 +3174,5 @@
                 try:
                     check = item[0].GetValue()
-                except:
+                except Exception:
                     check = None
                 name = item[1]
@@ -3202,6 +3202,6 @@
                     for weight in self.weights[name]:
                         disfunc += ' ' + str(weight)
-            except:
-                logging.error(sys.exc_info()[1])
+            except Exception:
+                logging.error(traceback.format_exc())
             content += name + ',' + str(check) + ',' + value + disfunc + ':'
 
@@ -3403,6 +3403,6 @@
                                                        weights=pd_weights)
                             is_array = True
-                except:
-                    logging.error(sys.exc_info()[1])
+                except Exception:
+                    logging.error(traceback.format_exc())
                 if not is_array:
                     self._disp_obj_dict[name] = disp_model
@@ -3418,6 +3418,6 @@
                                              self.state.weights]
 
-            except:
-                logging.error(sys.exc_info()[1])
+            except Exception:
+                logging.error(traceback.format_exc())
                 print "Error in BasePage._paste_poly_help: %s" % \
                                         sys.exc_info()[1]
Index: src/sas/sasgui/perspectives/fitting/fitting.py
===================================================================
--- src/sas/sasgui/perspectives/fitting/fitting.py	(revision 934ce6493af6e904cf20f2500ef522b42192adfd)
+++ src/sas/sasgui/perspectives/fitting/fitting.py	(revision 7673ecd9d5adcefdfa1fc6a6d1ff0649f8e63bc8)
@@ -273,5 +273,6 @@
                         wx.PostEvent(self.parent, evt)
                         break
-        except:
+        except Exception:
+            import traceback; traceback.print_exc()
             msg = 'Delete Error: \nCould not delete the file; Check if in use.'
             wx.MessageBox(msg, 'Error')
@@ -579,5 +580,5 @@
                 _, theory_state = item
                 self.fit_panel.set_model_state(theory_state)
-            except:
+            except Exception:
                 msg = "Fitting: cannot deal with the theory received"
                 evt = StatusEvent(status=msg, info="error")
Index: src/sas/sasgui/perspectives/fitting/models.py
===================================================================
--- src/sas/sasgui/perspectives/fitting/models.py	(revision cb4ef58d8aabd8393aae14823d3fa98d1ba0c1a2)
+++ src/sas/sasgui/perspectives/fitting/models.py	(revision 7673ecd9d5adcefdfa1fc6a6d1ff0649f8e63bc8)
@@ -2,5 +2,5 @@
     Utilities to manage models
 """
-import imp
+import traceback
 import os
 import sys
@@ -8,4 +8,5 @@
 # Time is needed by the log method
 import time
+import datetime
 import logging
 import py_compile
@@ -20,4 +21,6 @@
 
 PLUGIN_DIR = 'plugin_models'
+PLUGIN_LOG = os.path.join(os.path.expanduser("~"), '.sasview', PLUGIN_DIR,
+                          "plugins.log")
 
 def get_model_python_path():
@@ -28,11 +31,12 @@
 
 
-def log(message):
+def plugin_log(message):
     """
     Log a message in a file located in the user's home directory
     """
-    dir = os.path.join(os.path.expanduser("~"), '.sasview', PLUGIN_DIR)
-    out = open(os.path.join(dir, "plugins.log"), 'a')
-    out.write("%10g:  %s\n" % (time.clock(), message))
+    out = open(PLUGIN_LOG, 'a')
+    now = time.time()
+    stamp = datetime.datetime.fromtimestamp(now).strftime('%Y-%m-%d %H:%M:%S')
+    out.write("%s: %s\n" % (stamp, message))
     out.close()
 
@@ -51,9 +55,9 @@
     if not issubclass(model, Model1DPlugin):
         msg = "Plugin %s must be of type Model1DPlugin \n" % str(name)
-        log(msg)
+        plugin_log(msg)
         return None
     if model.__name__ != "Model":
         msg = "Plugin %s class name must be Model \n" % str(name)
-        log(msg)
+        plugin_log(msg)
         return None
     try:
@@ -63,5 +67,5 @@
                                                              str(sys.exc_type),
                                                              sys.exc_info()[1])
-        log(msg)
+        plugin_log(msg)
         return None
 
@@ -72,9 +76,9 @@
             msg = "Plugin %s: error writing function \n\t :%s %s\n " % \
                     (str(name), str(sys.exc_type), sys.exc_info()[1])
-            log(msg)
+            plugin_log(msg)
             return None
     else:
         msg = "Plugin  %s needs a method called function \n" % str(name)
-        log(msg)
+        plugin_log(msg)
         return None
     return model
@@ -132,8 +136,8 @@
     """
     def __nonzero__(self):
-        type, value, traceback = sys.exc_info()
+        type, value, tb = sys.exc_info()
         if type is not None and issubclass(type, py_compile.PyCompileError):
             print "Problem with", repr(value)
-            raise type, value, traceback
+            raise type, value, tb
         return 1
 
@@ -155,57 +159,33 @@
 
 def _findModels(dir):
+    """
+    Find custom models
+    """
     # List of plugin objects
-    plugins = {}
     dir = find_plugins_dir()
     # Go through files in plug-in directory
-    #always recompile the folder plugin
     if not os.path.isdir(dir):
-        msg = "SasView couldn't locate Model plugin folder."
-        msg += """ "%s" does not exist""" % dir
+        msg = "SasView couldn't locate Model plugin folder %r." % dir
         logging.warning(msg)
-        return plugins
-    else:
-        log("looking for models in: %s" % str(dir))
-        compile_file(dir)
-        logging.info("plugin model dir: %s" % str(dir))
-    try:
-        list = os.listdir(dir)
-        for item in list:
-            toks = os.path.splitext(os.path.basename(item))
-            if toks[1] == '.py' and not toks[0] == '__init__':
-                name = toks[0]
-                path = [os.path.abspath(dir)]
-                file = None
-                try:
-                    (file, path, info) = imp.find_module(name, path)
-                    module = imp.load_module(name, file, item, info)
-                    if hasattr(module, "Model"):
-                        try:
-                            if _check_plugin(module.Model, name) != None:
-                                plugins[name] = module.Model
-                        except:
-                            msg = "Error accessing Model"
-                            msg += "in %s\n  %s %s\n" % (name,
-                                                         str(sys.exc_type),
-                                                         sys.exc_info()[1])
-                            log(msg)
-                    else:
-                        filename = os.path.join(dir, item)
-                        plugins[name] = load_custom_model(filename)
-
-                except:
-                    msg = "Error accessing Model"
-                    msg += " in %s\n  %s %s \n" % (name,
-                                                   str(sys.exc_type),
-                                                   sys.exc_info()[1])
-                    log(msg)
-                finally:
-
-                    if not file == None:
-                        file.close()
-    except:
-        # Don't deal with bad plug-in imports. Just skip.
-        msg = "Could not import model plugin: %s" % sys.exc_info()[1]
-        log(msg)
+        return {}
+
+    plugin_log("looking for models in: %s" % str(dir))
+    #compile_file(dir)  #always recompile the folder plugin
+    logging.info("plugin model dir: %s" % str(dir))
+
+    plugins = {}
+    for filename in os.listdir(dir):
+        name, ext = os.path.splitext(filename)
+        if ext == '.py' and not name == '__init__':
+            path = os.path.abspath(os.path.join(dir, filename))
+            try:
+                model = load_custom_model(path)
+            except Exception:
+                msg = traceback.format_exc()
+                msg += "\nwhile accessing model in %r" % path
+                plugin_log(msg)
+                logging.warning("Failed to load plugin %r. See %s for details"
+                                % (path, PLUGIN_LOG))
+            plugins[model.name] = model
 
     return plugins
Index: src/sas/sasgui/perspectives/fitting/pagestate.py
===================================================================
--- src/sas/sasgui/perspectives/fitting/pagestate.py	(revision c10d9d6c8667422d3db329ac32d0528a6cce3fc6)
+++ src/sas/sasgui/perspectives/fitting/pagestate.py	(revision 7673ecd9d5adcefdfa1fc6a6d1ff0649f8e63bc8)
@@ -19,5 +19,5 @@
 import logging
 import numpy
-import string
+import traceback
 
 import xml.dom.minidom
@@ -473,6 +473,6 @@
             try:
                 value = content[1]
-            except:
-                logging.error(sys.exc_value)
+            except Exception:
+                logging.error(traceback.format_exc())
             if name.count("State created"):
                 repo_time = "" + value
@@ -515,6 +515,6 @@
                         title = content[2] + " [" + repo_time + "]"
                         title_name = HEADER % title
-                except:
-                    logging.error(sys.exc_value)
+                except Exception:
+                    logging.error(traceback.format_exc())
             if name == "model name ":
                 try:
@@ -530,6 +530,6 @@
                     q_name = ("Q Range:    " + q_range)
                     q_range = CENTRE % q_name
-                except:
-                    logging.error(sys.exc_value)
+                except Exception:
+                    logging.error(traceback.format_exc())
         paramval = ""
         for lines in param_string.split(":"):
@@ -864,6 +864,6 @@
                             attribute = getattr(self, item[1])
                             attribute[name] = com_name
-                        except:
-                            logging.error(sys.exc_value)
+                        except Exception:
+                            logging.error(traceback.format_exc())
 
                 # get self.values and self.weights dic. if exists
@@ -880,7 +880,7 @@
                                 val = float(line)
                                 value_list.append(val)
-                            except:
+                            except Exception:
                                 # pass if line is empty (it happens)
-                                logging.error(sys.exc_value)
+                                logging.error(traceback.format_exc())
                         dic[name] = numpy.array(value_list)
                     setattr(self, item[1], dic)
@@ -1293,5 +1293,5 @@
                     if len(note_value) > 0:
                         data_info.notes.append(note_value)
-            except:
+            except Exception:
                 err_mess = "cansas_reader.read: error processing entry notes\n  %s" % sys.exc_value
                 self.errors.append(err_mess)
@@ -1315,5 +1315,5 @@
                     if len(detail_value) > 0:
                         data_info.sample.details.append(detail_value)
-            except:
+            except Exception:
                 err_mess = "cansas_reader.read: error processing sample details\n  %s" % sys.exc_value
                 self.errors.append(err_mess)
