I have loaded pictures from a folder in a list with code like this in a loop :
file = u"E:\\pict" + str(i) + ".jpg"
tab[i] = graphics.Image.open(file)
Then i need to delete a picture file on the memory card and i use for example :
while i < MAX:
file1 = u"E:\\pict" + str(i+1) + ".jpg"
file2 = u"E:\\pict" + str(i) + ".jpg"
e32.file_copy(file2,file1)
x = x + 1
file = u"E:\\pict" + str(MAX) + ".jpg"
os.remove(file)
The problem is that there is sometimes an exception on e32.filc_copy "[Error 14] KerrInUse" or on remove "[Error 13] Permission denied" and sometimes the file is copied or deleted ans sometimes no.
I Tried to initialize tab with a loop and tab[i] = None in order to unlock "read locks" on the files but it doesn't work better.
Does anyone know solution about these lock problems ?
Thanks

Reply With Quote



