I managed to add some code below to have a seperate csv file.
How can i achieve that?
Thanks
import time import schedule import csv #starttime=time.time() def task(): #Input_file: "C:\\Campbellsci\\LoggerNet\\CR1000_Table1.dat" #Output_file: "C:\\Users\\Makada\\Desktop\\CR1000_Table1 - kopie.dat" while True: """ Not to append duplicate data to output file""" existingLines = set(line.strip() for line in open("C:\\Users\\Makada\\Desktop\\CR1000_Table1 - kopie.dat")) outfile = open("C:\\Users\\Makada\\Desktop\\CR1000_Table1 - kopie.dat", "a+") for content in open("C:\\Campbellsci\\LoggerNet\\CR1000_Table1.dat", "r"): if content.strip() not in existingLines: # to void duplicate lines outfile.write(content) existingLines.add(content) outfile.close() with open("C:\\Users\\Makada\\Desktop\\CR1000_Table1 - kopie.dat", "r") as f: with open("C:\\Users\\Makada\\Desktop\\CR1000_Table1 - kopie.csv", "a+") as f1: for line in f: f1.write(line) schedule.every().minute.at(":01").do(task) while True: schedule.run_pending() time.sleep(1) refresh()The CSV file is getting the data but after that, i get a error:
Traceback (most recent call last): File "F:\Software\python definitief\copieer bron naar copie alleen nieuw data deze werkt op de minuut precies kopie.py", line 31, in <module> schedule.run_pending() File "C:\Python\lib\site-packages\schedule\__init__.py", line 563, in run_pending default_scheduler.run_pending() File "C:\Python\lib\site-packages\schedule\__init__.py", line 94, in run_pending self._run_job(job) File "C:\Python\lib\site-packages\schedule\__init__.py", line 147, in _run_job ret = job.run() File "C:\Python\lib\site-packages\schedule\__init__.py", line 466, in run ret = self.job_func() File "F:\Software\python definitief\copieer bron naar copie alleen nieuw data deze werkt op de minuut precies kopie.py", line 23, in task with open("C:\\Users\\Makada\\Desktop\\CR1000_Table1 - kopie.csv", "a+") as f1: PermissionError: [Errno 13] Permission denied: 'C:\\Users\\Makada\\Desktop\\CR1000_Table1 - kopie.csv' >>>And the csv file isnt displayed the comma seperated data in Excel in columns.
How can i achieve that?
Thanks