Changeset 1467


Ignore:
Timestamp:
May 26, 2005, 11:23:46 AM (19 years ago)
Author:
duncan
Message:

bug fix

File:
1 edited

Legend:

Unmodified
Added
Removed
  • inundation/ga/storm_surge/pmesh/load_mesh/loadASCII.py

    r1439 r1467  
    8585NOMAXAREA=-999
    8686
    87 #FIXME (DSG-DSG) this is used by least_squares -
    88 #                   is this the best function for it to use?
    89 # (DSG-DSG) put an exception handler in import_triangulation/import_mesh_file
    90 # Think about exceptions before doing this!
    91 def mesh_file_to_mesh_dictionary(file_name):
    92     """Load a pmesh file.  Returning the mesh dictionary.
    93     """
    94     try:
    95         meshdic = import_mesh_file(file_name)
    96     except IOError, e:       
    97         msg = 'Could not open file %s ' %file_name
    98         raise IOError, msg
    99     return meshdic
    100 
    10187# This is used by pmesh
    10288def import_mesh_file(ofile):
     
    115101            msg = 'Extension %s is unknown' %ofile[-4:]
    116102            raise IOError, msg
    117     except (SyntaxError,IndexError):
     103    except (SyntaxError,IndexError, ValueError): #FIXME No test for ValueError
    118104            msg = 'File could not be opened'
    119             raise IOError, msg       
     105            raise IOError, msg 
    120106    return dict
    121107
     
    1009995        except (IndexError,ValueError,SyntaxError):
    1010996            fd.close()   
    1011             msg = 'File could not be opened'
     997            msg = 'Could not open file %s ' %ofile
     998            raise IOError, msg
     999
     1000
     1001
     1002
     1003
     1004
     1005
     1006
     1007        except IOError:
     1008            # Catch this to add an error message
     1009            msg = 'Could not open file %s ' %ofile
    10121010            raise IOError, msg
    10131011       
Note: See TracChangeset for help on using the changeset viewer.