0

I had this code running successfully on a Raspberry Pi:

from subprocess import check_output
import csv
from datetime import datetime
import threading

cmd = ['/usr/bin/ebusctl', 'read', '-f']
header = ['Date','Time','Flow','Return','Flame']

with open('/media/pi/VAILLANT/vaillant_log.csv', 'w', newline = '') as f:
    writer = csv.writer(f)
    writer.writerow(header)

def read_ebus():
    threading.Timer(10.0, read_ebus).start()

    date = datetime.today().strftime('%Y-%m-%d')
    time = datetime.today().strftime('%H:%M:%S')
    flow_temp =  float(check_output([*cmd, 'FlowTemp', 'temp']))
    return_temp =  float(check_output([*cmd, 'ReturnTemp', 'temp']))
    flame =  check_output([*cmd, 'Flame'])

    data = [date,time,flow_temp,return_temp,flame]

    with open('/media/pi/VAILLANT/vaillant_log.csv', 'a', newline='') as f:
        writer = csv.writer(f)
        writer.writerow(data)
read_ebus()

When I try to run it on adifferent RPi I get this error:

pi@raspberrypi:~ $ python vaillant/vaillant3.py
File "vaillant/vaillant3.py", line 18
flow_temp =  float(check_output([*cmd, 'FlowTemp', 'temp']))
                                 ^
SyntaxError: invalid syntax

Any ideas why this is happening please?

Mike
  • 3
  • 3

0 Answers0