#!/usr/bin/python3 import time import json import configparser def getValue(s): v = s.split(' ')[0] return v def getUnit(s): u = s.split(' ')[1] return u if __name__ == '__main__': config = configparser.RawConfigParser() config.read('brewpi.cfg') print (getValue(config.get('Global', 'samplerate'))) print (getValue(config.get('Controller', 'cont_ctrl'))) print (getValue(config.get('Controller', 'heatrate'))) fp = open("brewpi.cfg.json") configJson = json.load(fp) print (json.dumps({'config' : configJson}, indent=4, sort_keys=True)) print ("End of program.")