So I'm trying to read in data from my arduino, however it seems that it only creates the file after my script has stopped executing. Either by stopping it manually or just running through the entire script.
Now my questions is mainly how can it already create the file during the while loop and append to it. And why is not working now?
import csv
import time
while True:
row = ['1', '2', '3']
with open('results.csv', 'a') as csvfile:
csv_writer = csv.writer(csvfile)
csv_writer.writerow(row)
time.sleep(1)
The code blob above can be used to reproduce this behaviour. I would like to create results.csv while it is using the while loop and not after its execution.