Changeset e090ba90 in sasview for src/sas/sascalc/fit/models.py
- 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
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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
Note: See TracChangeset
for help on using the changeset viewer.