But when I try to write to another file and read GPS serial port in the same loop it , nothing is written to the file.
GPS data is displayed correctly and file.txt is created. But when I open it it is blank. Can anyone please help
Code: Select all
import serial import time ser = serial.Serial('/dev/ttyS0' ) f=open("file.txt","w+") while 1: x=ser.readline() print (x) f.write('writing to file \n')