def basic_test_7(): old_use_exceptions_status = gdal.GetUseExceptions() gdal.UseExceptions() ret = basic_test_7_internal() if old_use_exceptions_status == 0: gdal.DontUseExceptions() return ret
def setGdalException(e=True): old = gdal.GetUseExceptions() if e: gdal.PushErrorHandler(GdalErrorHandler().handler) gdal.UseExceptions() else: gdal.DontUseExceptions() gdal.PopErrorHandler() return old == 1
def _RaiseException(): if gdal.GetUseExceptions(): _StoreLastException() raise RuntimeError(gdal.GetLastErrorMsg())