May-22-2017, 08:18 PM
(May-22-2017, 04:20 AM)pydeveloper Wrote:def setConfigSetting(self, *args, setting): currentDict = self.configSettings for s in args: currentDict = currentDict[s] print(currentDict) currentDict = settingtried executing this code but an error is popping out.
Can someone please help me with the error above in line 48.
Error:Traceback (most recent call last): File "C:/Users/Downloads/Yaml-parser.py", line 48, in <module> testConfig.setConfigSetting("version", 2) TypeError: setConfigSetting() missing 1 required keyword-only argument: 'setting'
Thank you.
In your functon declaration, the
*args
catches all positional parameters, so "setting" must be an option keyword parameter.I don't see much benefint in being able to set several settings to the same value so you can just as well use simpler
setting_name, setting_value
args.
Unless noted otherwise, code in my posts should be understood as "coding suggestions", and its use may require more neurones than the two necessary for Ctrl-C/Ctrl-V.
Your one-stop place for all your GIMP needs: gimp-forum.net
Your one-stop place for all your GIMP needs: gimp-forum.net