From dade5d69aefb65c387bae4f7a38d39fddb4482d8 Mon Sep 17 00:00:00 2001 From: IbanLSCE Date: Fri, 15 Jan 2021 16:53:10 +0100 Subject: [PATCH] =?UTF-8?q?Correction=20du=20bug=20provanquant=20l'=C3=A9c?= =?UTF-8?q?rasement=20des=20donn=C3=A9es=20du=20fichier=20de=20position=20?= =?UTF-8?q?courant=20lors=20du=20red=C3=A9marage=20de=20programme=20python?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- HardwareController/Class_Positions_files_handler.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/HardwareController/Class_Positions_files_handler.py b/HardwareController/Class_Positions_files_handler.py index 36ded28..24c93c8 100644 --- a/HardwareController/Class_Positions_files_handler.py +++ b/HardwareController/Class_Positions_files_handler.py @@ -32,10 +32,14 @@ class positions_files_handler: # the last line writen in the file self.last_line_writen = "" - # open the log file and adds the name of the column at the begining - f = open(self.file_name, "w") - f.write("DATE TIME \tPosition\n") - f.close() + + # check if a log file for the same date exist + if(os.path.isfile(self.file_name) == False ): + # open the log file and adds the name of the column at the begining + f = open(self.file_name, "w") + f.write("DATE TIME \tPosition\n") + f.close() + #---FUNCTIONS --- -- GitLab