AWS Thinkbox Discussion Forums

Reading Settings From An External File

Not terribly experienced with scripting in deadline and getting lost in the docs!

I’m looking to read external settings into a Pre-Task script. I have the script working with fixed parameters, but now I want to expand on that.

Specifically, I want to have the ability to set certain parameters in an external .ini file for each project, for example the preferred version of a plugin.

Any pointers/suggestions would be very welcome!

Simon

Hey,
If you need to write to an existing INI file from within the Deadline environment, we do have a function that should help here:

docs.thinkboxsoftware.com/produc … a564113961

Here’s a quick example:

from Deadline.Scripting import * FileUtils.SetIniFileSetting( string fileName, string section, string key, string value )

To be honest, good old plain cPython is great at handling this as well:
wiki.python.org/moin/ConfigParserExamples

Actually, re-reading your post, do you actually want to ‘read’ in values from an INI file instead?

If so:

docs.thinkboxsoftware.com/produc … 824c365f95

FileUtils.GetIniFileSetting( string fileName, string section, string key, string defaultValue )

Either way, FileUtils class should be your friend here if you want to use Deadline Scripting instead of Python ConfigParser:
docs.thinkboxsoftware.com/produc … utils.html

If you do a quick wildcard search for either function throughout all our shipping *.py files in your Deadline repo, you should find plenty of examples here.

Thank you, Mike, that did the trick!

Cool.

Privacy | Site terms | Cookie preferences