Ignore:
Timestamp:
Mar 21, 2017 8:55:40 AM (7 years ago)
Author:
GitHub <noreply@…>
Parents:
26c9b85 (diff), b9b612a (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
git-author:
Jeff Krzywon <krzywon@…> (03/21/17 08:55:40)
git-committer:
GitHub <noreply@…> (03/21/17 08:55:40)
Message:

Merge b9b612aaa6fa09a6a967f55d93480819b20ee7d4 into 26c9b85eb05ac83c648348fc7879e08e3225ceb1

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/sas/sascalc/dataloader/loader.py

    rb699768 rb9b612a  
    3131from readers import ascii_reader 
    3232from readers import cansas_reader 
     33from readers import cansas_reader_HDF5 
    3334 
    3435class Registry(ExtensionRegistry): 
     
    6162            of a particular reader 
    6263 
    63         Defaults to the ascii (multi-column) reader 
    64         if no reader was registered for the file's 
    65         extension. 
     64        Defaults to the ascii (multi-column), cansas XML, and cansas NeXuS 
     65        readers if no reader was registered for the file's extension. 
    6666        """ 
    6767        try: 
    6868            return super(Registry, self).load(path, format=format) 
    69         except: 
    70             try: 
    71                 # No reader was found. Default to the ascii reader. 
    72                 ascii_loader = ascii_reader.Reader() 
    73                 return ascii_loader.read(path) 
    74             except: 
    75                 cansas_loader = cansas_reader.Reader() 
    76                 return cansas_loader.read(path) 
     69        except Exception: 
     70            pass # try the ASCII reader 
     71        try: 
     72            ascii_loader = ascii_reader.Reader() 
     73            return ascii_loader.read(path) 
     74        except Exception: 
     75            pass # try the cansas XML reader 
     76        try: 
     77            cansas_loader = cansas_reader.Reader() 
     78            return cansas_loader.read(path) 
     79        except Exception: 
     80            pass # try the cansas NeXuS reader 
     81        try: 
     82            cansas_nexus_loader = cansas_reader_HDF5.Reader() 
     83            return cansas_nexus_loader.read(path) 
     84        except Exception: 
     85            # No known reader available. Give up and throw an error 
     86            msg = "\n\tUnknown data format: %s.\n\tThe file is not a " % path 
     87            msg += "known format for SasView. The most common formats are " 
     88            msg += "multi-column ASCII, CanSAS XML, and CanSAS NeXuS." 
     89            raise Exception(msg) 
    7790 
    7891    def find_plugins(self, dir): 
Note: See TracChangeset for help on using the changeset viewer.