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 "<string>", line 1, in <module>
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
[email protected], http://forums.thefoundry.co.uk/
http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python

Reply via email to