nuke/python: delete/rename file after write?

We have a python script that we are using to convert the huge uncompressed EXR files from Mental Ray into ZIP compressed ones, on a frame by frame basis as they render so they do not fill up our disks. Basically the python script is launched by the Maya render after each frame, opens Nuke in terminal mode and does a ZIP compression on it, writing the compressed EXR out as a temp file.

That all works fine. As a last step we want to delete the original exr (render.###.exr) and rename the temp file (render.###.exr.tmp) to replace the old file (render.###.exr). We are on Windows, so we are doing this by calling DOS commands (del and ren) from the python script (os.system).

Trouble is, since the EXR file is loaded in Nuke in the read node it says the file is in use when we try to delete it. We tried killing the Nuke process, but then it kills the script too. Does anyone know a way around this?:thanks:

No Responses to “nuke/python: delete/rename file after write?”

Post a Comment