[gdal-dev] How can I track down autotest python error?

Even Rouault even.rouault at spatialys.com
Mon Jan 4 10:40:25 PST 2016


Le lundi 04 janvier 2016 19:32:33, David Adler a écrit :
> I'm getting:
> GDAL:
> GDALOpen(DB2ODBC:DB2:database=samp105;DSN=SAMP105A;tables=TEST.ZIPPOINT,
> this=004995C0) succeeds as DB2ODBC.
> GTiff: Reopen with strip chop enabled
> GDAL: GDALOpen(..\gcore\data/cfloat64.tif, this=0485BEC8) succeeds as
> GTiff.
> 
> ODBC: SQLDisconnect()
> GDAL:
> GDALClose(DB2ODBC:DB2:database=samp105;DSN=SAMP105A;tables=TEST.ZIPPOINT,
> this=004995C0) GDAL: GDALClose(..\gcore\data/cfloat64.tif, this=0485BEC8)
> Traceback (most recent call last):
>    File "../pymod\gdaltest_python2.py", line 42, in run_func
>      result = func()
>    File "ogr_db2r.py", line 278, in ogr_db2_CopyRaster1
>      new_ds = ogrtest.db2_drv.CreateCopy(
> 'DB2ODBC:database=samp105;DSN=SAMP105A', src_ds )
>    File
> "C:\Python27\lib\site-packages\gdal-2.1.0-py2.7-win32.egg\osgeo\ogr.py",
> line 363, in <lambda>
>      __getattr__ = lambda self, name: _swig_getattr(self, Driver, name)
>    File
> "C:\Python27\lib\site-packages\gdal-2.1.0-py2.7-win32.egg\osgeo\ogr.py",
> line 57, in _swig_getattr
>      raise AttributeError(name)
> AttributeError: CreateCopy
> GDAL: In GDALDestroy - unloading GDAL shared library.
> 
> from:
> def ogr_db2_CopyRaster1():
>      if ogrtest.db2_drv is None:
>          return 'skip'
>      ds = ogr.Open(ogrtest.db2_test_server)
>      if ds is None:
>          return 'fail'
>      src_ds = gdal.Open( '..\gcore\data/cfloat64.tif' )
>      new_ds = ogrtest.db2_drv.CreateCopy(
> 'DB2ODBC:database=samp105;DSN=SAMP105A', src_ds )
> 
> I'm guessing this is from CreateCopy. There is no other obvious error
> indication.

The issue is that you are calling CreateCopy() on a - legacy - OGR driver, 
which is not supported. You should call it on a driver returned by 
gdal.GetDriverByName() instead.

> This works fine from gdal_translate.
> 
> Any suggestions?

-- 
Spatialys - Geospatial professional services
http://www.spatialys.com


More information about the gdal-dev mailing list