Changeset e090ba90 in sasview for src/sas/sascalc/fit/models.py


Ignore:
Timestamp:
Oct 11, 2018 1:59:57 PM (6 years ago)
Author:
Paul Kienzle <pkienzle@…>
Branches:
master, magnetic_scatt, release-4.2.2, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1249
Children:
88d2e70
Parents:
67ed543
Message:

remove errors and warnings from py37 tests of sascalc

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/sas/sascalc/fit/models.py

    rb963b20 re090ba90  
    1212import py_compile 
    1313import shutil 
     14 
     15from six import reraise 
    1416 
    1517from sasmodels.sasview_model import load_custom_model, load_standard_models 
     
    6264    try: 
    6365        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)) 
    6869        plugin_log(msg) 
    6970        return None 
     
    7273        try: 
    7374            value = new_instance.function() 
    74         except Exception: 
     75        except Exception as exc: 
    7576            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) 
    7778            plugin_log(msg) 
    7879            return None 
     
    139140        if type is not None and issubclass(type, py_compile.PyCompileError): 
    140141            print("Problem with", repr(value)) 
    141             raise type, value, tb 
     142            reraise(type, value, tb) 
    142143        return 1 
    143144 
     
    153154        compileall.compile_dir(dir=dir, ddir=dir, force=0, 
    154155                               quiet=report_problem) 
    155     except Exception: 
    156         return sys.exc_info()[1] 
     156    except Exception as exc: 
     157        return exc 
    157158    return None 
    158159 
     
    185186                    model.name = PLUGIN_NAME_BASE + model.name 
    186187                plugins[model.name] = model 
    187             except Exception: 
     188            except Exception as exc: 
    188189                msg = traceback.format_exc() 
    189190                msg += "\nwhile accessing model in %r" % path 
Note: See TracChangeset for help on using the changeset viewer.