mirror of
https://github.com/django/django.git
synced 2025-07-03 17:29:12 +00:00
gis: gdal: Made error message when opening an invalid DataSource
more clear.
git-svn-id: http://code.djangoproject.com/svn/django/branches/gis@7571 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
462d731423
commit
acfc49ed4e
@ -72,9 +72,13 @@ class DataSource(object):
|
||||
if isinstance(ds_input, basestring):
|
||||
# The data source driver is a void pointer.
|
||||
ds_driver = c_void_p()
|
||||
|
||||
# OGROpen will auto-detect the data source type.
|
||||
ds = open_ds(ds_input, self._write, byref(ds_driver))
|
||||
try:
|
||||
# OGROpen will auto-detect the data source type.
|
||||
ds = open_ds(ds_input, self._write, byref(ds_driver))
|
||||
except OGRException:
|
||||
# Making the error message more clear rather than something
|
||||
# like "Invalid pointer returned from OGROpen".
|
||||
raise OGRException('Could not open the datasource at "%s"' % ds_input)
|
||||
elif isinstance(ds_input, c_void_p) and isinstance(ds_driver, c_void_p):
|
||||
ds = ds_input
|
||||
else:
|
||||
|
Loading…
x
Reference in New Issue
Block a user