ignore - just realised you said doesn't error.
Have you added a test to make sure its not just failing rather than not running



 
Howard



>________________________________
> From: Howard Jones <[email protected]>
>To: Nuke Python discussion <[email protected]> 
>Sent: Saturday, 19 November 2011, 15:06
>Subject: Re: Re: [Nuke-python] Getting autosave location of current script
> 
>
>Whats the error?
> 
>Howard
>
>
>
>>________________________________
>> From: Ron Ganbar <[email protected]>
>>To: Nuke Python discussion <[email protected]> 
>>Sent: Saturday, 19 November 2011, 14:59
>>Subject: Re: Re: [Nuke-python] Getting autosave location of current script
>> 
>>
>>Hey Ean. Thanks.Well, it doesn't error on startup. But it doesn't run the 
>>script when I close or quit.
>>Any ideas?
>>
>>
>>
>>Ron Ganbar
>>email: [email protected]
>>tel: +44 (0)7968 007 309 [UK]
>>     +972 (0)54 255 9765 [Israel]
>>url: http://ronganbar.wordpress.com/
>>
>>
>>
>>On 19 November 2011 16:09, Ean Carr <[email protected]> wrote:
>>
>>Oh, I see. Try:
>>>
>>>nuke.addOnScriptClose(remAutosave.remAutosave)
>>>
>>>And make sure you're importing nuke in remAutosave.py.
>>>
>>>-Ean
>>>
>>>
>>>
>>>On Sat, Nov 19, 2011 at 12:46 PM, Ron Ganbar <[email protected]> wrote:
>>>
>>>I must be doing something wrong. Obviously I am cause it's not working.
>>>>This is my menu.py:
>>>>
>>>>
>>>>###################
>>>>import remAutosave
>>>>
>>>>
>>>>nuke.addOnScriptClose(remAutosave)
>>>>###################
>>>>
>>>>
>>>>I have a file called remAutosave.py in my .nuke folder and in it I have the 
>>>>function:
>>>>
>>>>
>>>>
>>>>
>>>>###################
>>>>def remAutosave():
>>>>   autoS = nuke.toNode("preferences")["AutoSaveName"].evaluate()
>>>>   if os.path.isfile(autoS):
>>>>       ask = nuke.ask('Autosave file found.\nDelete?')
>>>>   if ask == True:
>>>>       os.remove(autoS)
>>>>###################
>>>>
>>>>
>>>>
>>>>
>>>>Yet Nuke gives me an error message on startup. Any idea?
>>>>
>>>>Thanks,
>>>>
>>>>Ron Ganbar
>>>>email: [email protected]
>>>>tel: +44 (0)7968 007 309 [UK]
>>>>     +972 (0)54 255 9765 [Israel]
>>>>url: http://ronganbar.wordpress.com/
>>>>
>>>>
>>>>
>>>>
>>>>On 19 November 2011 14:10, Ean Carr <[email protected]> wrote:
>>>>
>>>>Put this in your menu.py:
>>>>>
>>>>>nuke.addOnScriptClose(remAutosave)
>>>>>
>>>>>-E
>>>>>
>>>>>
>>>>>
>>>>>On Fri, Nov 18, 2011 at 5:39 PM, Ron Ganbar <[email protected]> wrote:
>>>>>
>>>>>So how do I automatically add this to all scripts' onScriptClose property?
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>Ron Ganbar
>>>>>>email: [email protected]
>>>>>>tel: +44 (0)7968 007 309 [UK]
>>>>>>     +972 (0)54 255 9765 [Israel]
>>>>>>url: http://ronganbar.wordpress.com/
>>>>>>
>>>>>>
>>>>>>
>>>>>>On 18 November 2011 19:29, Michael Habenicht <[email protected]> wrote:
>>>>>>
>>>>>>Hallo Abraham,
>>>>>>>
>>>>>>>you have to use evaluate() instead of getValue().
>>>>>>>
>>>>>>>So a more universal version of Ron's script should look like this:
>>>>>>>
>>>>>>>def remAutosave():
>>>>>>>   autoS = nuke.toNode("preferences")["AutoSaveName"].evaluate()
>>>>>>>
>>>>>>>   if os.path.isfile(autoS):
>>>>>>>       ask = nuke.ask('Autosave file found.\nDelete?')
>>>>>>>   if ask == True:
>>>>>>>       os.remove(autoS)
>>>>>>>
>>>>>>>Viele Grüße in die Türkenstraße!
>>>>>>>Michael
>>>>>>>
>>>>>>>------------------------------------------
>>>>>>>DI (FH) Michael Habenicht
>>>>>>>compositing - vfx :: motiongraphics :: dvd
>>>>>>>
>>>>>>>http://www.tinitron.de
>>>>>>>[email protected]
>>>>>>>**
>>>>>>>Digital Compositor & TD TRIXTER Film Munich
>>>>>>>http://www.trixter.de
>>>>>>>------------------------------------------
>>>>>>>
>>>>>>>
>>>>>>>----- Original Message -----
>>>>>>>From: [email protected]
>>>>>>>To: [email protected]
>>>>>>>Date: 18.11.2011 17:06:05
>>>>>>>Subject: Re: [Nuke-python] Getting autosave location of current script
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>> I already wrote a very simple version of this function. As for every 
>>>>>>>> other
>>>>>>>> script I ever wrote - it's not finished and pretty straight forward.
>>>>>>>> Of course, it doesn't answer your question. Still, it relates, so here 
>>>>>>>> it
>>>>>>>> is.
>>>>>>>> By the way, it's designed to be added as a onScriptClose function.
>>>>>>>>
>>>>>>>>
>>>>>>>> def remAutosave():
>>>>>>>> script = nuke.Root()['name'].getValue()
>>>>>>>>  autoS = script + '.autosave'
>>>>>>>> if os.path.isfile(autoS):
>>>>>>>>  ask = nuke.ask('Autosave file found.\nDelete?')
>>>>>>>> if ask == True:
>>>>>>>>  os.remove(autoS)
>>>>>>>>
>>>>>>>>
>>>>>>>> Ron Ganbar
>>>>>>>> email: [email protected]
>>>>>>>> tel: +44 (0)7968 007 309 [UK]
>>>>>>>>      +972 (0)54 255 9765 [Israel]
>>>>>>>> url: http://ronganbar.wordpress.com/
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>>> On 18 November 2011 18:00, Abraham Schneider  wrote:
>>>>>>>>
>>>>>>>> > Hi there!
>>>>>>>> >
>>>>>>>> > I wanted to write a callback function to automatically delete
>>>>>>>> > the .autosave file, if the script was closed correctly. I find it 
>>>>>>>> > very
>>>>>>>> > irritating to get the 'there is a newer autosave' message when 
>>>>>>>> > loading
>>>>>>>> > a script, even if the script was closed properly and on purpose
>>>>>>>> > without saving it when closing. I'd only like to keep the autosave
>>>>>>>> > file if Nuke crashes or something like that.
>>>>>>>> >
>>>>>>>> > Problem is: my scripting skills aren't that good. I wanted to start
>>>>>>>> > with checking if an autosave file exists. To do this, I wanted to use
>>>>>>>> > the actual value for the AutoSaveName set in the preferences. By
>>>>>>>> > default, this value is set to '[firstof [value root.name] [getenv
>>>>>>>> > NUKE_TEMP_DIR]/].autosave'. I'm able to get the string from the
>>>>>>>> > preferences with something like:
>>>>>>>> >
>>>>>>>> > myprefs = nuke.toKnob('preferences')
>>>>>>>> > print myprefs.knob('AutoSaveName').**getValue()
>>>>>>>
>>>>>>>> >
>>>>>>>> > or
>>>>>>>> >
>>>>>>>> > print nuke.tcl('value preferences.AutoSaveName')
>>>>>>>> >
>>>>>>>> >
>>>>>>>> > that always gives me the string '[firstof [value root.name] [getenv
>>>>>>>> > NUKE_TEMP_DIR]/].autosave'. But what I'd really want to get is the
>>>>>>>> > evaluated value of the string, so I tried it with 'eval', 'expr',
>>>>>>>> > 'expression', etc., but didn't get any result. The only way a got a
>>>>>>>> > result was when I used "print nuke.tcl('eval [value
>>>>>>>> > preferences.AutoSaveName]')":
>>>>>>>> >
>>>>>>>> > print nuke.tcl('eval [value preferences.AutoSaveName]')
>>>>>>>> > # Result:
>>>>>>>> > Traceback (most recent call last):
>>>>>>>> > File "", line 1, in
>>>>>>>> > RuntimeError: Syntax error at 
>>>>>>>> > "/mnt/frozone/projects/vier_**hunde_1234"
>>>>>>>
>>>>>>>> >
>>>>>>>> > So it IS doing something, but there seems to be an syntax error. But 
>>>>>>>> > I
>>>>>>>> > can't see what the error is.
>>>>>>>> >
>>>>>>>> > Can anyone explain to me why that doesn't work and/or how to get the
>>>>>>>> > proper result that Nuke also uses internally as the path for the
>>>>>>>> > autosave file? Or better: what would be a good way to delete the
>>>>>>>> > autosave file of the script that I'm closing on purpose without 
>>>>>>>> > saving?
>>>>>>>> >
>>>>>>>> > Thanks for any help and sorry if the code above hurts your eyes, I'm
>>>>>>>> > just starting to script in Nuke and find the mixture of TCL and 
>>>>>>>> > Python
>>>>>>>> > still very confusing.
>>>>>>>> >
>>>>>>>> > Best regards,
>>>>>>>> >
>>>>>>>> > Abraham
>>>>>>>> >
>>>>>>>> >
>>>>>>>> > Abraham Schneider
>>>>>>>> > Senior VFX Compositor
>>>>>>>> >
>>>>>>>> >
>>>>>>>> > ARRI Film & TV Services GmbH
>>>>>>>> > Tuerkenstr. 89
>>>>>>>> > D-80799 Muenchen / Germany
>>>>>>>> >
>>>>>>>> > Phone +49 89 3809-1269
>>>>>>>> >
>>>>>>>> > EMail [email protected]
>>>>>>>> > www.arri.de/filmtv
>>>>>>>> > ______________________________**__
>>>>>>>
>>>>>>>> >
>>>>>>>> >
>>>>>>>> > ARRI Film & TV Services GmbH
>>>>>>>> > Sitz: München Registergericht: Amtsgericht München
>>>>>>>> > Handelsregisternummer: HRB 69396
>>>>>>>> > Geschäftsführer: Franz Kraus, Dr. Martin Prillmann, Josef Reidinger
>>>>>>>> > ______________________________**_________________
>>>>>>>> > 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
>>>>>>>> [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
>>>>>>>
>>>>>>
>>>>>>_______________________________________________
>>>>>>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
>>>>>
>>>>>
>>>>
>>>>_______________________________________________
>>>>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
>>>
>>>
>>
>>_______________________________________________
>>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
>
>
>
_______________________________________________
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