我通过上面获取的IDataSet,在下面Block函数缺不能用,出现AttributeError: 'NoneType' object has no attribute 'SetGeoTransform'的错误,我觉得应该是下面IDataSet没有获取的原因,因为上面的的问题指示的内容是没有错误的
问题相关代码,请勿粘贴截图
for tarFile in tarFiles:
filename = os.path.basename(tarFile)
filename_split = filename.split("_")
outFileName = filename[:-4]
print(outFileName)
outname = os.path.join(InputFilePath,outFileName)
atcfiles = os.path.join(OutputFilePath,outFileName)
tiffFiles = glob.glob(os.path.join(outname + "*.tif")) # [0]
for tiffFile in tiffFiles:
try:
IDataSet = gdal.Open(tiffFile)
except Exception as e:
print("文件%%S打开失败" % tiffFile)
Block(IDataSet, filename_split, atcfiles, config, metedata, outFileName)