Changes in src/sas/sascalc/dataloader/loader.py [b699768:b9b612a] in sasview
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/sascalc/dataloader/loader.py
rb699768 rb9b612a 31 31 from readers import ascii_reader 32 32 from readers import cansas_reader 33 from readers import cansas_reader_HDF5 33 34 34 35 class Registry(ExtensionRegistry): … … 61 62 of a particular reader 62 63 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. 66 66 """ 67 67 try: 68 68 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) 77 90 78 91 def find_plugins(self, dir):
Note: See TracChangeset
for help on using the changeset viewer.