Python的gdal库读取tif,出现no attribute 'SetGeoTransform'

使用Python的gdal库读取tif格式遥感图像并将其切割为多个小图读取地理信息时出现AttributeError: 'NoneType' object has no attribute 'SetGeoTransform',若是影像有问题以什么修改代码能继续读取或者怎么处理修改影像

    ds.SetGeoTransform(geotransform1)
    ds.SetProjection(projection)
    lay01 = ds.GetRasterBand(1)
    lay02 = ds.GetRasterBand(2)
    lay03 = ds.GetRasterBand(3)

 

Traceback (most recent call last):
  File "E:/atiff/c/GDAL_CLIP.py", line 232, in <module>
    ds.SetGeoTransform(geotransform1)
AttributeError: 'NoneType' object has no attribute 'SetGeoTransform'