ConfigParser.NoSectionError: No section: u'graphics' error

327 views
Skip to first unread message

Ryan Doherty

unread,
Nov 25, 2014, 10:49:34 AM11/25/14
to kivy-...@googlegroups.com
Hello, I'm following the Settings documentation here http://kivy.org/docs/api-kivy.uix.settings.html, but when I run my code I get the following error: 

 Traceback (most recent call last):
   File "main.py", line 331, in <module>
     RaceCaptureApp().run()
   File "/Applications/Kivy.app/Contents/Resources/kivy/kivy/app.py", line 766, in run
     root = self.build()
   File "main.py", line 242, in build
     settings_view.add_json_panel('App Settings', config, os.path.join(os.getcwd(), 'resource', 'settings', 'settings.json'))
   File "/Applications/Kivy.app/Contents/Resources/kivy/kivy/uix/settings.py", line 933, in add_json_panel
     panel = self.create_json_panel(title, config, filename, data)
   File "/Applications/Kivy.app/Contents/Resources/kivy/kivy/uix/settings.py", line 973, in create_json_panel
     instance = cls(panel=panel, **str_settings)
   File "/Applications/Kivy.app/Contents/Resources/kivy/kivy/uix/settings.py", line 282, in __init__
     self.value = self.panel.get_value(self.section, self.key)
   File "/Applications/Kivy.app/Contents/Resources/kivy/kivy/uix/settings.py", line 622, in get_value
     return config.get(section, key)
   File "/Applications/Kivy.app/Contents/Resources/kivy/kivy/config.py", line 318, in get
     value = PythonConfigParser.get(self, section, option, **kwargs)
   File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/ConfigParser.py", line 607, in get
     raise NoSectionError(section)
 ConfigParser.NoSectionError: No section: u'graphics'

My settings.json file looks like this (pretty much copy/pasted from the docs):

[
    {
        "type": "title",
        "title": "Settings"
    },
    {
        "type": "bool",
        "title": "Fullscreen",
        "desc": "Set the window in windowed or fullscreen",
        "section": "graphics",
        "key": "fullscreen",
        "true": "auto"
    }
]

My code:
        config = ConfigParser()
        config.read('myconfig.ini')

        settings_view = Settings()
        settings_view.add_json_panel('App Settings', config, os.path.join(os.getcwd(), 'resource', 'settings', 'settings.json'))

And the settings.json file is 

What is this 'graphics' section that it's complaining about? Is it something that's supposed to be in myconfig.ini? I've googled around and can't find anything related to this. Thanks!
-Ryan

n3m

unread,
May 6, 2015, 4:27:00 PM5/6/15
to kivy-...@googlegroups.com
you need to modify your config file: add sections and keys according to your panel json data
Reply all
Reply to author
Forward
0 new messages