Skip to content

Commit

Permalink
Put file close further down, after all possible uses, but before delete
Browse files Browse the repository at this point in the history
  • Loading branch information
neilflood committed Sep 26, 2024
1 parent 4c7e661 commit 88209e2
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion rios/riostests/teststats.py
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,6 @@ def runOneTest(driverName, creationOptions, fileDtype, scalefactor, offset,
ds = gdal.Open(outfiles.outimg)
band = ds.GetRasterBand(1)
outarr = band.ReadAsArray()
del ds

# Get stats from file, and from array, and compare
stats1 = getStatsFromBand(band)
Expand Down Expand Up @@ -262,6 +261,7 @@ def runOneTest(driverName, creationOptions, fileDtype, scalefactor, offset,
histOK = checkHistogram(band, outarr, nullVal, iterationName)
ok = ok and histOK

del ds
if os.path.exists(outfiles.outimg):
riostestutils.removeRasterFile(outfiles.outimg)
return ok
Expand Down

0 comments on commit 88209e2

Please sign in to comment.