from osgeo import gdal # Enable GDAL/OGR exceptions gdal.UseExceptions() # open dataset that does not exist ds = gdal.Open('test.tif') # results in python RuntimeError exception that # `test.tif' does not exist in the file system
默认情况下,GDAL/OGR Python绑定不引发异常时发生错误。他们返回一个错误值,如没有写错误消息sys.stdout。你可以通过调用useexceptions()功能异常:
关注公众号
获取免费资源
Copyright © Since 2014.
开源地理空间基金会中文分会
吉ICP备05002032号
Powered by TorCMS