Write node file knob gives error

I’m trying to learn some basics in Python, and it’s slowly moving ahead by searching this forum. But now I’ve run into a problem. I’m trying to create a write node and set the file knob to the correct path, but it gives me an error. This is the code:

Code:

def autoWrite():

path = "[python {'/'.join(nuke.root()['name'].value().split('/')[0:-3])}]/renders/nuke/[string trim [file tail [value root.name]] .nk]/[string trim [file tail [value root.name]] .nk]_####.exr"
nuke.createNode("Write").knob('file').setValue(path)


If I run this code I get an error saying "IndentationError: expected an indented block". Although, if I remove the "def autoWrite" in the beginning the code works. Problem is that I need to def autoWrite for it to work with my menu.py file.

The path takes the current position of the nuke script and automatically creates render locations for the script.

No Responses to “Write node file knob gives error”

Post a Comment