Suppress error output of called program to get alfred data

master
Thomas Hooge 2017-02-02 19:48:51 +01:00
parent 80a97ab35f
commit ea7403f890
1 changed files with 5 additions and 1 deletions

View File

@ -20,7 +20,11 @@ class Alfred(object):
if self.unix_sock:
cmd.extend(['-s', self.unix_sock])
output = subprocess.check_output(cmd)
# There should not be any warnings which would be sent by cron
# every minute. Therefore suppress error output of called program
FNULL = open(os.devnull, 'w')
output = subprocess.check_output(cmd, stderr=FNULL)
close(FNULL)
return json.loads(output.decode("utf-8")).values()
def nodeinfo(self):