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

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:

NatronEngine.AppSettings.getParams()

Documentation for NatronEngine.AppSettings.getParams()

Natron 2.3.13
Windows 10

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.

app=app1
app.getProjectParam('outputFormat').set('HD_720') 

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.

Cheers,
Paul

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

app.getProjectParam('outputFormat').set('HD_720')

Ah! Yes. getProjectParam kept registering in my tired brain as strictly a value getter, not a parameter getter. So after I get the parameter, I’m free to get and set values.

But still, the broader issue for me is knowing what project parameters are available for me to access. Python’s built-in dir function obviously offers no help her. The whole reason why I was using NatronEngine.AppSettings.getParams() was to get a list of available parameters that I could get and set to. And I’m not seeing this in the documentation, although I haven’t read it from start to finish, so maybe it’s in there somewhere. And I’m still not entirely sure if NatronEngine.AppSettings.getParams() is broken or not as I’m not sure if I’m properly calling it (I think I am).

I could be very wrong, caz I am not a programmer, so don’t quote me on this.
I think that it’s confusing because Natron API document is still in progress. I feel that NatronEngine.AppSetting is just a base class that App class either inherit it, or has interface to access the actual appSetting instance.