NeblioTeam/NEBL-Pi

neblio.conf not being read

ChristopherRush opened this issue · 1 comments

I have added [config] to the neblio.conf file in order for me to parse the settings into a python script, however when I run neblio-qt -server it cannot read the file due to the insertion. Is there another way around this?

Answered by own question here by appending the section header to the string:

import ConfigParser
import StringIO

nebliopath='/home/pi/.neblio/neblio.conf'


with open(nebliopath, 'r') as f:
    a = '[dummy]\n'
    b = f.read()
    config_string = a + b

buf = StringIO.StringIO(config_string)
config = ConfigParser.ConfigParser()

config.readfp(buf)