Changeset cba0c77 in sasview


Ignore:
Timestamp:
Aug 12, 2016 11:27:38 AM (8 years ago)
Author:
lewis
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, costrafo411, magnetic_scatt, release-4.1.1, release-4.1.2, release-4.2.2, release_4.0.1, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
Children:
70308f6c
Parents:
2eb3d18c
Message:

Show more useful message when loading folder fails (closes #614)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/sas/sasgui/guiframe/local_perspectives/data_loader/data_loader.py

    rfaa3ae7 rcba0c77  
    162162            logging.error("Loader returned an invalid object:\n %s" % str(item)) 
    163163            data_error = True 
    164          
     164 
    165165        data = self.parent.create_gui_data(item, p_file) 
    166166        output[data.id] = data 
     
    176176        data_error = False 
    177177        error_message = "" 
     178 
    178179        for p_file in path: 
    179180            info = "info" 
     
    182183            if extension.lower() in EXTENSIONS: 
    183184                any_error = True 
     185                info = "error" 
    184186                log_msg = "Data Loader cannot " 
    185187                log_msg += "load: %s\n" % str(p_file) 
    186188                log_msg += """Please try to open that file from "open project" """ 
    187                 log_msg += """or "open analysis" menu\n""" 
    188                 error_message = log_msg + "\n" 
     189                log_msg += """or "open analysis" menu\n\n""" 
     190                error_message += log_msg 
    189191                logging.info(log_msg) 
    190192                continue 
     
    210212                logging.error(sys.exc_value) 
    211213                any_error = True 
    212             if any_error or error_message != "": 
    213                 if error_message == "": 
    214                     error = "Error: " + str(sys.exc_info()[1]) + "\n" 
    215                     error += "while loading Data: \n%s\n" % str(basename) 
    216                     error_message += "The data file you selected could not be loaded.\n" 
    217                     error_message += "Make sure the content of your file" 
    218                     error_message += " is properly formatted.\n\n" 
    219                     error_message += "When contacting the SasView team, mention the" 
    220                     error_message += " following:\n%s" % str(error) 
    221                 elif data_error: 
    222                     base_message = "Errors occurred while loading " 
    223                     base_message += "{0}\n".format(basename) 
    224                     base_message += "The data file loaded but with errors.\n" 
    225                     error_message = base_message + error_message 
    226                 else: 
    227                     error_message += "%s\n" % str(p_file) 
     214            if any_error: 
     215                error = "Error: " + str(sys.exc_info()[1]) 
     216                error += " while loading file: %s" % str(basename) 
     217                error_message += "The data file you selected could not be loaded.\n" 
     218                error_message += "Make sure the content of your file" 
     219                error_message += " is properly formatted.\n" 
     220                error_message += "When contacting the SasView team, mention the" 
     221                error_message += " following:\n%s\n\n" % str(error) 
    228222                info = "error" 
    229          
     223            elif data_error: 
     224                base_message = "Errors occurred while loading " 
     225                base_message += "{0}\n".format(basename) 
     226                base_message += "The data file loaded but with errors.\n" 
     227                error_message = base_message + error_message 
     228                info = "error" 
     229 
    230230        if any_error or error_message: 
    231231            self.load_update(output=output, message=error_message, info=info) 
     
    254254        #    self.load_error(error_message) 
    255255        self.parent.add_data(data_list=output) 
    256  
    257  
    258  
Note: See TracChangeset for help on using the changeset viewer.