Ok, then have a look at the signature of addOnScriptLoad; addOnScriptLoad(call, args=(), kwargs={}, nodeClass='Root')
You need to pass it a callable, then (optional) any positional arguments to that callable as a tuple, then (optional) any keyword arguments as a dictionary... Ex. def ttt(message): nuke.tprint(message) nuke.addOnScriptLoad(ttt, "this is a test", ) On Thu, Jul 21, 2011 at 3:35 PM, Dan Rosen <danrosenro...@yahoo.com> wrote: > I was trying to pass it something to the function, like: > > nuke.addOnScriptSave(yourOwnFunction("start")) > > but it does work the way that you mention > > nuke.addOnScriptSave(yourOwnFunction) > > > On Thu, Jul 21, 2011 at 2:16 PM, Ivan Busquets <ivanbusqu...@gmail.com> wrote: >> What are you passing as an argument to addOnScriptLoad? >> >> >From the error message, you're not passing it a callable. You need to >> pass it the function object (callable) itself, not a string, or the >> result of your function. >> >> Ex. >> >> def yourOwnFunction(): >> blah >> blah >> blah >> >> nuke.addOnScriptLoad(yourOwnFunction) >> >> >> On Thu, Jul 21, 2011 at 1:54 PM, Dan Rosen <danrosenro...@yahoo.com> wrote: >>> I've tried this in the menu.py, but it has an error. I've even plugged >>> in a dummy Python script that only prints a simple message, so I don't >>> think that it's my code. Maybe I'm still overlooking something, but I >>> get the following error: >>> >>> Traceback (most recent call last): >>> File "<string>", line 2, in <module> >>> File >>> "/Applications/Nuke6.2v4/Nuke6.2v4.app/Contents/MacOS/plugins/nuke/callbacks.py", >>> line 84, in addOnScriptSave >>> _addCallback(onScriptSaves, call, args, kwargs, nodeClass) >>> File >>> "/Applications/Nuke6.2v4/Nuke6.2v4.app/Contents/MacOS/plugins/nuke/callbacks.py", >>> line 14, in _addCallback >>> raise ValueError("call must be a callable") >>> ValueError: call must be a callable >>> >>> >>> On Tue, Jul 19, 2011 at 1:07 PM, Deke Kincaid <dekekinc...@gmail.com> wrote: >>>> something like this in your init/menu.py: >>>> nuke.addOnScriptLoad(pythonScriptFunction) >>>> -deke >>>> On Tue, Jul 19, 2011 at 13:01, Dan Rosen <danrosenro...@yahoo.com> wrote: >>>>> >>>>> I'd like to set the Project Settings > Python field for onScriptLoad >>>>> at load time via menu.py or init.py. I understand that I can stick >>>>> this into a template.nk script and that it will be there every time I >>>>> load Nuke, but I want to put something in that field for existing >>>>> scripts that don't have it. Any ideas? >>>>> >>>>> Thanks, >>>>> Dan >>>>> _______________________________________________ >>>>> 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 >>>> >>>> >>>> _______________________________________________ >>>> 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 >>>> >>>> >>> _______________________________________________ >>> 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 >>> >> _______________________________________________ >> 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 >> > _______________________________________________ > 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 > _______________________________________________ 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