Django

Code

Changeset 7571

Show
Ignore:
Timestamp:
06/04/08 12:24:08 (6 months ago)
Author:
jbronn
Message:

gis: gdal: Made error message when opening an invalid DataSource more clear.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • django/branches/gis/django/contrib/gis/gdal/datasource.py

    r7003 r7571  
    7373            # The data source driver is a void pointer. 
    7474            ds_driver = c_void_p() 
    75  
    76             # OGROpen will auto-detect the data source type. 
    77             ds = open_ds(ds_input, self._write, byref(ds_driver)) 
     75            try: 
     76                # OGROpen will auto-detect the data source type. 
     77                ds = open_ds(ds_input, self._write, byref(ds_driver)) 
     78            except OGRException: 
     79                # Making the error message more clear rather than something 
     80                # like "Invalid pointer returned from OGROpen". 
     81                raise OGRException('Could not open the datasource at "%s"' % ds_input) 
    7882        elif isinstance(ds_input, c_void_p) and isinstance(ds_driver, c_void_p): 
    7983            ds = ds_input