From 255dfc7f8f9618ca8eeea95103d90193977ecee7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niclas=20M=C3=BCller?= <41211702+mr15@users.noreply.github.com> Date: Tue, 24 Dec 2024 12:54:43 +0100 Subject: [PATCH 1/2] Update convert_to_csv.py to remove ":" characters from csv file path --- backup_py/convert_to_csv.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/backup_py/convert_to_csv.py b/backup_py/convert_to_csv.py index 51e6d98..a2982af 100644 --- a/backup_py/convert_to_csv.py +++ b/backup_py/convert_to_csv.py @@ -19,7 +19,11 @@ def phpfina_get_meta(datadir,feedid): def phpfina_convert(datadir,csvdir,feedid,tag,name): meta = phpfina_get_meta(datadir,feedid) - csv_fh = open(csvdir+str(feedid)+"-"+str(tag)+"-"+str(name)+".csv","w") + print(tag) + print(name) + csv_path = csvdir+str(feedid)+"-"+str(tag)+"-"+str(name)+".csv" + csv_path= csv_path.replace(":", "-") # this is needed on windows at least because ":" are not allowed in file names + csv_fh = open(csv_path,"w") fh = open(datadir+str(feedid)+".dat","rb") for i in range(0,meta['npoints']): time = meta['start_time'] + i*meta['interval'] @@ -32,8 +36,9 @@ def phptimeseries_convert(datadir,csvdir,feedid,tag,name): if os.path.isfile(datadir+"feed_"+str(feedid)+".MYD"): bytesize = os.stat(datadir+"feed_"+str(feedid)+".MYD").st_size npoints = int(bytesize/9.0) - - csv_fh = open(csvdir+str(feedid)+"-"+str(tag)+"-"+str(name)+".csv","w") + csv_path = csvdir+str(feedid)+"-"+str(tag)+"-"+str(name)+".csv" + csv_path = csv_path.replace(":", "-") # this is needed on windows at least because ":" are not allowed in file names + csv_fh = open(csv_path,"w") fh = open(datadir+"feed_"+str(feedid)+".MYD","rb") for i in range(0,npoints): From 468429fd72cc53a46db9ecde19cc51685d86a448 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niclas=20M=C3=BCller?= <41211702+mr15@users.noreply.github.com> Date: Tue, 24 Dec 2024 12:56:55 +0100 Subject: [PATCH 2/2] Update convert_to_csv.py: removed "prints" --- backup_py/convert_to_csv.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/backup_py/convert_to_csv.py b/backup_py/convert_to_csv.py index a2982af..4ff37b9 100644 --- a/backup_py/convert_to_csv.py +++ b/backup_py/convert_to_csv.py @@ -19,8 +19,6 @@ def phpfina_get_meta(datadir,feedid): def phpfina_convert(datadir,csvdir,feedid,tag,name): meta = phpfina_get_meta(datadir,feedid) - print(tag) - print(name) csv_path = csvdir+str(feedid)+"-"+str(tag)+"-"+str(name)+".csv" csv_path= csv_path.replace(":", "-") # this is needed on windows at least because ":" are not allowed in file names csv_fh = open(csv_path,"w")