Is there a good way of finding out what has locked a file or what is holding it so that it can’t be deleted?
In my code I unzip a few to a temporary folder, read the header lines with readline
, and then read the bulk of the file with CSV.read
. Afterwards I delete the file, or at least try to but in Windows always get the error IOError: unlink: resource busy or locked (EBUSY)
. I do close
the file when I’m done reading from it.
Once my code errors out I can delete the file with rm
in the REPL. I’m assuming when the function returns all the open files are closed. Maybe I should put the reading part in a separate function so ensure that everything is closed? That feels like a hack though.
Windows 10, Julia 0.7, Pkg.test(“ClimateDataIO”) specifically lines 286-292 of runtests.jl which tests ghg_read.jl.