ah yes, so it is, deprecated in 3000. cheers Ben
On Thu, Jan 24, 2013 at 10:29 AM, Ben Dickson <ben.dick...@rsp.com.au>wrote: > Nitpick: The "has_keys" method is deprecated in Python, in favour of this: > > if 'disable' in node.knobs(): > ... > > Further nitpicking, the function can be written like this: > > > def delDis(): > selection = nuke.selectedNodes() > if not selection: > nuke.message('No nodes selected') > return > > > if nuke.ask('Delete all selected Disabled nodes?'): > for node in selection: > if 'disable' in node.knobs() and node['disable'].value(): > nuke.delete(node) > > > On 23/01/13 22:53, Ean Carr wrote: > >> Hey guys, >> >> Dicts have methods like get() and has_key() so it's not necessary to >> try/catch errors just to get values from keys or check if a node has a >> particular knob or not, respectively. In this case I would simplify that >> func with something like: >> >> def NodeHasKnobWithName(node, name): >> >> return node.knobs().has_key(name) >> >> >> Cheers >> >> >> >> On Mon, Jan 21, 2013 at 11:45 AM, atomcraft78 >> <nuke-python-relay@thefoundry.**co.uk<nuke-python-re...@thefoundry.co.uk> >> <mailto:nuke-python-relay@**thefoundry.co.uk<nuke-python-re...@thefoundry.co.uk>>> >> wrote: >> >> __ >> >> Marc, you're a star, yes filtering out all the nodes that cause an >> error is the way forward. >> >> Works a treat, thanks for your help! >> Chris >> >> ______________________________**_________________ >> Nuke-python mailing list >> >> Nuke-python@support.**thefoundry.co.uk<Nuke-python@support.thefoundry.co.uk> >> >> <mailto:Nuke-python@support.**thefoundry.co.uk<Nuke-python@support.thefoundry.co.uk> >> >, >> http://forums.thefoundry.co.**uk/ <http://forums.thefoundry.co.uk/> >> http://support.thefoundry.co.**uk/cgi-bin/mailman/listinfo/** >> nuke-python<http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python> >> >> >> >> >> >> ______________________________**_________________ >> Nuke-python mailing list >> Nuke-python@support.**thefoundry.co.uk<Nuke-python@support.thefoundry.co.uk>, >> http://forums.thefoundry.co.**uk/ <http://forums.thefoundry.co.uk/> >> http://support.thefoundry.co.**uk/cgi-bin/mailman/listinfo/**nuke-python<http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python> >> > > -- > ben dickson > 2D TD | ben.dick...@rsp.com.au > rising sun pictures | www.rsp.com.au > > ______________________________**_________________ > Nuke-python mailing list > Nuke-python@support.**thefoundry.co.uk<Nuke-python@support.thefoundry.co.uk>, > http://forums.thefoundry.co.**uk/ <http://forums.thefoundry.co.uk/> > http://support.thefoundry.co.**uk/cgi-bin/mailman/listinfo/**nuke-python<http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python> >
_______________________________________________ Nuke-python mailing list Nuke-python@support.thefoundry.co.uk, http://forums.thefoundry.co.uk/ http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python