Index: src/sas/sasgui/perspectives/calculator/model_editor.py
===================================================================
--- src/sas/sasgui/perspectives/calculator/model_editor.py	(revision a1b8fee73528559155793dd74cda07d0c32e9d72)
+++ src/sas/sasgui/perspectives/calculator/model_editor.py	(revision 490c6178857045bec2f0e71215cb13f12f239152)
@@ -657,5 +657,5 @@
         self.warning = ""
         #This does not seem to be used anywhere so commenting out for now
-        #    -- PDB 2/26/17 
+        #    -- PDB 2/26/17
         #self._description = "New Plugin Model"
         self.function_tcl = None
@@ -740,5 +740,5 @@
         self.param_sizer.AddMany([(param_txt, 0, wx.LEFT, 10),
                                   (self.param_tcl, 1, wx.EXPAND | wx.ALL, 10)])
-        
+
         # Parameters with polydispersity
         pd_param_txt = wx.StaticText(self, -1, 'Fit Parameters requiring ' + \
@@ -755,5 +755,5 @@
         self.pd_param_tcl.setDisplayLineNumbers(True)
         self.pd_param_tcl.SetToolTipString(pd_param_tip)
-        
+
         self.param_sizer.AddMany([(pd_param_txt, 0, wx.LEFT, 10),
                                   (self.pd_param_tcl, 1, wx.EXPAND | wx.ALL, 10)])
@@ -1030,12 +1030,12 @@
         if has_scipy:
             lines.insert(0, 'import scipy')
-        
-        # Think about 2D later        
+
+        # Think about 2D later
         #self.is_2d = func_str.count("#self.ndim = 2")
         #line_2d = ''
         #if self.is_2d:
         #    line_2d = CUSTOM_2D_TEMP.split('\n')
-        
-        # Also think about test later        
+
+        # Also think about test later
         #line_test = TEST_TEMPLATE.split('\n')
         #local_params = ''
@@ -1043,5 +1043,5 @@
         spaces4  = ' '*4
         spaces13 = ' '*13
-        spaces16 = ' '*16     
+        spaces16 = ' '*16
         param_names = []    # to store parameter names
         has_scipy = func_str.count("scipy.")
@@ -1055,9 +1055,9 @@
             out_f.write(line + '\n')
             if line.count('#name'):
-                out_f.write('name = "%s" \n' % name)               
+                out_f.write('name = "%s" \n' % name)
             elif line.count('#title'):
-                out_f.write('title = "User model for %s"\n' % name)               
+                out_f.write('title = "User model for %s"\n' % name)
             elif line.count('#description'):
-                out_f.write('description = "%s"\n' % desc_str)               
+                out_f.write('description = "%s"\n' % desc_str)
             elif line.count('#parameters'):
                 out_f.write('parameters = [ \n')
@@ -1075,5 +1075,5 @@
                         out_f.write("%s['%s', '', %s, [-numpy.inf, numpy.inf], 'volume', ''],\n" % (spaces16, pname, pvalue))
                 out_f.write('%s]\n' % spaces13)
-            
+
         # No form_volume or ER available in simple model editor
         out_f.write('def form_volume(*arg): \n')
@@ -1082,5 +1082,5 @@
         out_f.write('def ER(*arg): \n')
         out_f.write('    return 1.0 \n')
-        
+
         # function to compute
         out_f.write('\n')
@@ -1091,7 +1091,7 @@
         for func_line in func_str.split('\n'):
             out_f.write('%s%s\n' % (spaces4, func_line))
-        
+
         Iqxy_string = 'return Iq(numpy.sqrt(x**2+y**2) '
-            
+
         out_f.write('\n')
         out_f.write('def Iqxy(x, y ')
@@ -1113,9 +1113,12 @@
         items = line.split(";")
         for item in items:
-            name = item.split("=")[0].lstrip().rstrip()
+            name = item.split("=")[0].strip()
             try:
-                value = item.split("=")[1].lstrip().rstrip()
+                value = item.split("=")[1].strip()
+                if value.count("#"):
+                    # If line ends in a comment, remove it before parsing float
+                    value = value[:value.index("#")].strip()
                 float(value)
-            except:
+            except ValueError:
                 value = 1.0 # default
 
@@ -1204,5 +1207,5 @@
 import numpy
 
-#name 
+#name
 
 #title
@@ -1210,5 +1213,5 @@
 #description
 
-#parameters 
+#parameters
 
 """
