Python Forum
Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
setconfig setting
#2
(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 = setting
tried executing this code but an error is popping out.

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'
Can someone please help me with the error above in line 48.

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
Reply


Messages In This Thread
setconfig setting - by pydeveloper - May-22-2017, 04:20 AM
RE: setconfig setting - by Ofnuts - May-22-2017, 08:18 PM
RE: setconfig setting - by pydeveloper - May-22-2017, 08:32 PM
RE: setconfig setting - by Ofnuts - May-22-2017, 08:43 PM
RE: setconfig setting - by pydeveloper - May-22-2017, 08:48 PM
RE: setconfig setting - by nilamo - May-22-2017, 09:20 PM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020