Draft decoder holding onto input even after .FinalizeEncoding() has run


#1

Happy new year draft forum!

Im trying to clean up some temp files , that were used durning an encoding job.
im waiting till after i have run my .FinalizeEncoding(), sleeping for 3 seconds, then trying to remove the tamp incoming file that i passed to the decoder class earlier in the script.

since i see no way to finalise the decoder class, is there something im missing , that would allow me to delete these files. seems like something still has a hold on the file.

the sudo code is:

copy incoming file to local temp.
decoder = Draft.VideoDecoder(file_copied_to_local_temp)
for frame in range:
    do some overlay cool things to current frame
    encoder.EncodeNextFrame(frame)
encoder.FinalizeEncoding()

if temp_folder:
    time.sleep(3)
    shutil.rmtree(temp_folder)

at this point shutil throws a:

The process cannot access the file because it is being used by another process

Any ideas on what could be occuring?

Cheers
kym


#2

Hmm no answers yet.
So rephrasing the question, is there a better way to clean up the files after running draft?