[gdal-dev] Python gdal catch ERROR 6

Even Rouault even.rouault at spatialys.com
Wed Oct 7 06:29:29 PDT 2015


Le mercredi 07 octobre 2015 15:15:20, Luca Delucchi a écrit :
> Hi devs,
> 
> PDF driver is actually supporting only 8 bit band, and if I try to
> create a layer using CreateCopy function with a dataset different from
> 8 bit I get "ERROR 6: PDF driver doesn't support data type UInt16.
> Only eight bit byte bands supported."
> 
> I try to catch this error using try/except but it doesn't work, should
> I test if the result of CreateCopy is not None? Is there any other
> better way to catch this error?

Yes, either test for None return, or call gdal.UseExceptions() and then Python 
exceptions will be thrown when a GDAL error occurs.

> 
> thanks

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


More information about the gdal-dev mailing list