diff --git a/Ohmpi.py b/Ohmpi.py index 85f4f25378dee873141dd64a5de0f54fb7fd8dea..9fd2abd3e43036892f3f457ba7b477bff3e7781e 100644 --- a/Ohmpi.py +++ b/Ohmpi.py @@ -136,9 +136,9 @@ class OhmPi(object): if self.output == 'print': if level == 'error': - print(colored(level.upper() + ' : ' + msg), 'red') + print(colored(level.upper() + ' : ' + msg, 'red')) elif level == 'warn': - print(colored(level.upper() + ' : ' + msg), 'yellow') + print(colored(level.upper() + ' : ' + msg, 'yellow')) else: print(level.upper() + ' : ' + msg) elif self.output == 'mqtt': @@ -165,7 +165,8 @@ class OhmPi(object): if isinstance(config, dict): self.pardict.update(config) else: - dic = json.loads(config) + with open(config) as json_file: + dic = json.load(json_file) self.pardict.update(dic) self.dump('Acquisition parameters updated: ' + str(self.pardict), level='debug') @@ -589,8 +590,8 @@ class OhmPi(object): self.dump('status = ' + self.status) # test -#with open('ohmpi_param.json') as json_file: -# pardict = json.load(json_file) -ohmpi = OhmPi() +#ohmpi = OhmPi(config='ohmpi_param.json') #ohmpi.measure() +#time.sleep(4) +#ohmpi.stop() diff --git a/dd.txt b/dd.txt index c00dd97c0e6e65562c0bca92249bffe10dcad327..de98f6448d1e37cbeab1fae857981571bbf38a1f 100644 --- a/dd.txt +++ b/dd.txt @@ -1,5 +1,5 @@ 1 2 3 4 -1 3 5 7 +1 1 5 7 1 4 7 10 1 5 9 13 1 6 11 16