You can put a check in to see if the directory already exists: if not os.path.isdir(dir): os.makedirs( osdir )
Cheer, Andy ----- Original Message ----- From: "Julien Chandelle" <julienchande...@gmail.com> To: "Nuke user discussion" <nuke-users@support.thefoundry.co.uk> Sent: Monday, 12 December, 2011 10:38:23 AM Subject: [Nuke-users] issues with auto create directory Hey, I put the script to create the directory that doesn't exist before a render in init.py. I found it here : http://docs.thefoundry.co.uk/nuke/63/pythondevguide/callbacks.html#beforerender def createWriteDir(): import nuke, os file = nuke.filename(nuke.thisNode()) dir = os.path.dirname( file ) osdir = nuke.callbacks.filenameFilter( dir ) os.makedirs( osdir ) nuke.addBeforeRender(createWriteDir) When a make the first render everything is ok, he create the dir and make the render. But if I want relaunch the render and over wirte the existing file he said to me : Traceback (most recent call last): File "<string>", line 1, in <module> File "/usr/local/Nuke6.3v5/plugins/nukescripts/renderpanel.py", line 8, in render_panel return nukescripts.showRenderDialog(_list, exceptOnError) File "/usr/local/Nuke6.3v5/plugins/nukescripts/renderdialog.py", line 702, in showRenderDialog d.run() File "/usr/local/Nuke6.3v5/plugins/nukescripts/renderdialog.py", line 236, in run nuke.executeMultiple(self._nodeSelection, frame_ranges, views, continueOnError = self._continueOnError.value()) RuntimeError: [Errno 17] File exists : [filepath of the destination of my images] I'm on nuke 6.3v5 and Linux -- Julien Chandelle GSM : +32 (0) 494 277 542 julienchandelle.be @jimbiscuit || imdb || Nuke , AE & Fusion Compositor || _______________________________________________ Nuke-users mailing list Nuke-users@support.thefoundry.co.uk, http://forums.thefoundry.co.uk/ http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-users
_______________________________________________ Nuke-users mailing list Nuke-users@support.thefoundry.co.uk, http://forums.thefoundry.co.uk/ http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-users