Open a tcp socket and continuously read the stream in a non-working way. Items in the stream are seperated by a cartridge return. Use regex to remove the non numeric characters but allowing the decimal point from the item and add each cleaned item to a public queue named rawData.
import re import socket s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.connect((TCP_IP, TCP_PORT)) s.send("READ") while True: data = s.recv(BUFFER_SIZE) data = data.replace("\n", "") data = data.replace("\r", "") data = re.sub("[^0-9.]", "", data) rawData.put(data)