Changeset e090ba90 in sasview for src/sas/sascalc/fit
- Timestamp:
- Oct 11, 2018 1:59:57 PM (6 years ago)
- Branches:
- master, magnetic_scatt, release-4.2.2, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1249
- Children:
- 88d2e70
- Parents:
- 67ed543
- Location:
- src/sas/sascalc/fit
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/sascalc/fit/expression.py
r574adc7 re090ba90 210 210 211 211 #print("Function: "+functiondef) 212 exec functiondef in globals,locals212 exec(functiondef, globals, locals) 213 213 retfn = locals['eval_expressions'] 214 214 -
src/sas/sascalc/fit/models.py
rb963b20 re090ba90 12 12 import py_compile 13 13 import shutil 14 15 from six import reraise 14 16 15 17 from sasmodels.sasview_model import load_custom_model, load_standard_models … … 62 64 try: 63 65 new_instance = model() 64 except Exception: 65 msg = "Plugin %s error in __init__ \n\t: %s %s\n" % (str(name), 66 str(sys.exc_type), 67 sys.exc_info()[1]) 66 except Exception as exc: 67 msg = ("Plugin %s error in __init__ \n\t: %s %s\n" 68 % (name, type(exc), exc)) 68 69 plugin_log(msg) 69 70 return None … … 72 73 try: 73 74 value = new_instance.function() 74 except Exception :75 except Exception as exc: 75 76 msg = "Plugin %s: error writing function \n\t :%s %s\n " % \ 76 (str(name), str( sys.exc_type), sys.exc_info()[1])77 (str(name), str(type(exc)), exc) 77 78 plugin_log(msg) 78 79 return None … … 139 140 if type is not None and issubclass(type, py_compile.PyCompileError): 140 141 print("Problem with", repr(value)) 141 r aise type, value, tb142 reraise(type, value, tb) 142 143 return 1 143 144 … … 153 154 compileall.compile_dir(dir=dir, ddir=dir, force=0, 154 155 quiet=report_problem) 155 except Exception :156 return sys.exc_info()[1]156 except Exception as exc: 157 return exc 157 158 return None 158 159 … … 185 186 model.name = PLUGIN_NAME_BASE + model.name 186 187 plugins[model.name] = model 187 except Exception :188 except Exception as exc: 188 189 msg = traceback.format_exc() 189 190 msg += "\nwhile accessing model in %r" % path -
src/sas/sascalc/fit/pagestate.py
r863ac2c re090ba90 650 650 #Truncating string so print doesn't complain of being outside margins 651 651 if sys.platform != "win32": 652 MAX_STRING_LENG HT= 50653 if len(file_value) > MAX_STRING_LENG HT:654 file_value = "File name:.."+file_value[-MAX_STRING_LENG HT+10:]652 MAX_STRING_LENGTH = 50 653 if len(file_value) > MAX_STRING_LENGTH: 654 file_value = "File name:.."+file_value[-MAX_STRING_LENGTH+10:] 655 655 file_name = CENTRE % file_value 656 656 if len(title) == 0: … … 905 905 doc_model = newdoc.createElement('model_list_item') 906 906 doc_model.setAttribute('checked', str(model[0].GetValue())) 907 keys = model[1].keys()907 keys = list(model[1].keys()) 908 908 doc_model.setAttribute('name', str(keys[0])) 909 909 values = model[1].get(keys[0]) … … 964 964 if node.get('version'): 965 965 # Get the version for model conversion purposes 966 x = re.sub( '[^\d.]', '', node.get('version'))966 x = re.sub(r'[^\d.]', '', node.get('version')) 967 967 self.version = tuple(int(e) for e in str.split(x, ".")) 968 968 # The tuple must be at least 3 items long … … 984 984 try: 985 985 self.timestamp = float(entry.get('epoch')) 986 except Exception :986 except Exception as exc: 987 987 msg = "PageState.fromXML: Could not" 988 msg += " read timestamp\n %s" % sys.exc_value988 msg += " read timestamp\n %s" % exc 989 989 logger.error(msg) 990 990 … … 1282 1282 if isinstance(data.run_name, dict): 1283 1283 # Note: key order in dict is not guaranteed, so sort 1284 name = data.run_name.keys()[0]1284 name = list(data.run_name.keys())[0] 1285 1285 else: 1286 1286 name = data.run_name
Note: See TracChangeset
for help on using the changeset viewer.