State:New|TargetRelease:No Target|icon_bug|icon_katana|database:public|Resolution:Fixed|BugID:419347|
Problem summary
When setting Katana preferences via Python, it is possible to set a preference to a value of a type that the preference shouldn't accept (for example a string value for a preference that should only accept integers). This can lead to issues like errors when initialising the UI, preventing users from launching the software.
Customer reported version
Katana 3.2v1
Customer reported platform
Windows 10
Steps to reproduce
Run the following code in a Python tab in Katana:
from UI4.KatanaPrefs import Prefs, PrefNames
Prefs[PrefNames.RENDERING_THREADS_2D] = "I'm a string"
Expected behaviour
As this preference (application\rendering\interactiveRenderThreads2D) should accept integer values only, the value of the preference is not modified and a warning or error message is shown to the user.
Actual behaviour
Error in event handler __renderThreads_pref_callback() for event type "pref_changed": ValueError: invalid literal for int() with base 10: "I'm a string" [ERROR python.root]: A ValueError occurred in "KatanaPrefsObject.py": invalid literal for int() with base 10: "I'm a string" Traceback (most recent call last):
File "python/Main\Main.py", line 429, in <module>
File "python/Main\Main.py", line 413, in __main
File "MainUI.py", line 15, in Main
File "MainUI.py", line 36, in Main
File "MainUI.py", line 59, in InitializeInterface
File "App/__init__.py", line 22, in <module>
File "App/AutoSave.py", line 21, in <module>
File "KatanaPrefs/__init__.py", line 177, in <module>
File "KatanaPrefs/KatanaPrefsObject.py", line 120, in declareIntPref
ValueError: invalid literal for int() with base 10: "I'm a string"
Workaround
Reproduced by support
Katana 3.2v3 - Windows 10/CentOS7
Katana 3.1v1 - Windows 10/CentOS7
Partially reproduced
The following versions allow the preference to be set to an unsupported value, but seem to fall back to the default on the next launch instead of using the invalid preference value and replace the previous value with the default in Prefs2.ini on close:
Katana 3.0v1 - Windows 10/CentOS7
Katana 2.6v3 - Windows 10/CentOS7
Katana 2.5v1 - Windows 10/CentOS7
Katana 1.6v3 - CentOS 7
We're sorry to hear that
Please tell us why