Having issues. Python -> NatronEngine.AppSettings.getParams()


(Paul Waggonner) #1

Hi all,

So I’m learning how to navigate Natron with Python, and having trouble. What I’m trying to do is pick an output format in Natron settings. I’m under the impression that before I pick a format, maybe I need to see what formats there are first, therefore, I’m trying to read Natron’s settings via code. According to the docs, NatronEngine.AppSettings.getParams() “Returns a sequence with all Param composing the settings.”. Yet, when I run that function, I get the following error:

While executing script:
NatronEngine.AppSettings.getParams()Python error:
Python exception: descriptor 'getParams' of 'NatronEngine.AppSettings' object needs an argument
Traceback (most recent call last):
 File "<string>", line 1, in <module>
TypeError: descriptor 'getParams' of 'NatronEngine.AppSettings' object needs an argument.

While the error message indicates NatronEngine.AppSettings.getParams() requires an argument, the documentation indicates no argument is necessary. Out of curiosity, I tried passing in a random string, then Natron complains with:

TypeError: descriptor 'getParams' requires a 'NatronEngine.AppSettings' object but received a 'str'

So is this function just not working, or am I calling it wrong? I’m calling it just like this:


Documentation for NatronEngine.AppSettings.getParams()

Natron 2.3.13
Windows 10

(Meng-Han Ho) #2

Not sure where you are going to run the script. But if you are trying it out in script editor, do the following for accessing project output format param.


(Paul Waggonner) #3

Thanks for the snippet mnhan32. It does work in my script editor, and I will likely use this in my code. I plan on using this code from natronRenderer.exe which will be started from a bat file, or windows shell.

Unfortunately, all the NatronEngine.AppSettings methods I’ve tried fail. I need access to this class’es functions.

Anyone, can you verify if NatronEngine.AppSettings.getParams() does or does not work? Am I calling this function wrong? If not, I would like to log this as a bug.


(Meng-Han Ho) #4

You can still use the same script to set or get project params.
The only different is that you don’t need to do app=app1 if you are not running in script editor. Natron automatically assigned current instance to app in nonGUI mode.
So, simply do the following