What you have there is a series of Python statements, not a single Python 
expression which you generally want for Nuke knob values (though if you really 
need to you can do it with statements, look it up...) 



expression: nuke.thisNode()['file'].value().split('/')[13] 
statement: a = nuke.thisNode()['file'].value().split('/')[13] 


Note you need to use nuke.thisNode() which is a magical reference to the 
'current' node Nuke is evaluating things for. 


Also note you might not actually want to use value() on the file knob, but 
rather evaluate(), or possibly even nuke.filename(). All of these things are in 
the Nuke Python docs if you want more info on them. 


Good luck! 

----- Original Message -----

From: "RP" <[email protected]> 
To: [email protected] 
Sent: Thursday, 19 July, 2012 6:21:10 PM 
Subject: [Nuke-python] Simple string implementation question 


Hello all, 

I'm sure you've heard it here a million times already, but I'm a complete 
python newbie in desperate need of help 

I am trying to create a read node that has a label taken from the 13th 
directory from its path name. 

I can get it to print the name of the 13th directory using 

a = nuke.selectedNode()['file'].value().split('/')[13] 
print a 


but I cant seem to implement this into the label of a read node 

Any clues? 
RP 
_______________________________________________ 
Nuke-python mailing list 
[email protected], http://forums.thefoundry.co.uk/ 
http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python 

_______________________________________________
Nuke-python mailing list
[email protected], http://forums.thefoundry.co.uk/
http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python

Reply via email to