Changeset 7b50f14 in sasview for src/sas/sascalc/dataloader/readers


Ignore:
Timestamp:
Sep 22, 2017 7:40:41 PM (7 years ago)
Author:
Paul Kienzle <pkienzle@…>
Branches:
master, ESS_GUI, ESS_GUI_Docs, ESS_GUI_batch_fitting, ESS_GUI_bumps_abstraction, ESS_GUI_iss1116, ESS_GUI_iss879, ESS_GUI_iss959, ESS_GUI_opencl, ESS_GUI_ordering, ESS_GUI_sync_sascalc, magnetic_scatt, release-4.2.2, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
Children:
d04ac05
Parents:
46cf4c9
Message:

restore python 2 functionality

Location:
src/sas/sascalc/dataloader/readers
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/sas/sascalc/dataloader/readers/cansas_reader_HDF5.py

    r5c5e7fd r7b50f14  
    99import sys 
    1010 
    11 from sas.sascalc.dataloader.data_info import plottable_1D, plottable_2D,\ 
     11from ..data_info import plottable_1D, plottable_2D,\ 
    1212    Data1D, Data2D, DataInfo, Process, Aperture, Collimation, \ 
    1313    TransmissionSpectrum, Detector 
    14 from sas.sascalc.dataloader.data_info import combine_data_info_with_plottable 
    15 from sas.sascalc.dataloader.loader_exceptions import FileContentsException, DefaultReaderException 
    16 from sas.sascalc.dataloader.file_reader_base_class import FileReader 
    17  
    18 def decode(s): 
    19     return s.decode() if isinstance(s, bytes) else s 
     14from ..data_info import combine_data_info_with_plottable 
     15from ..loader_exceptions import FileContentsException, DefaultReaderException 
     16from ..file_reader_base_class import FileReader, decode 
    2017 
    2118def h5attr(node, key, default=None): 
     
    135132            # Get all information for the current key 
    136133            value = data.get(key) 
    137             classname = h5attr(value, u'canSAS_class') 
    138             if classname is None: 
     134            class_name = h5attr(value, u'canSAS_class') 
     135            if class_name is None: 
    139136                class_name = h5attr(value, u'NX_class') 
    140137            if class_name is not None: 
     
    240237                            run_dict = {data_point: run_name} 
    241238                            self.current_datainfo.run_name = run_dict 
    242                         except: 
     239                        except Exception: 
    243240                            pass 
    244241                    elif key == u'title': 
  • src/sas/sascalc/dataloader/readers/xml_reader.py

    r5a6a84e r7b50f14  
    2020from lxml.builder import E 
    2121 
    22 from sas.sascalc.dataloader.file_reader_base_class import FileReader 
     22from ..file_reader_base_class import FileReader, decode 
    2323 
    2424logger = logging.getLogger(__name__) 
     
    153153        Converts an etree element into a string 
    154154        """ 
    155         return etree.tostring(elem, pretty_print=pretty_print, 
    156                               encoding=encoding).decode() 
     155        return decode(etree.tostring(elem, pretty_print=pretty_print, 
     156                                     encoding=encoding)) 
    157157 
    158158    def break_processing_instructions(self, string, dic): 
Note: See TracChangeset for help on using the changeset viewer.