My code is for a script that looks at a folder and deletes images that are under a resolution of 1920x1080. The problem I am having is that when my code runs;
I also had the issue, in windows [WinError 32]
Solved by changing:
try:
f = urllib.request.urlopen(url)
_, fname = tempfile.mkstemp()
with open(fname, 'wb') as ff:
ff.write(f.read())
img = imread(fname)
os.remove(fname)
return img
into:
try:
f = urllib.request.urlopen(url)
fd, fname = tempfile.mkstemp()
with open(fname, 'wb') as ff:
ff.write(f.read())
img = imread(fname)
os.close(fd)
os.remove(fname)
return img
As found here: https://no.coredump.biz/questions/45042466/permissionerror-winerror-32-when-trying-to-delete-a-temporary-image