summaryrefslogtreecommitdiff
path: root/Code/update_network.py
diff options
context:
space:
mode:
authorHui Lan <lanhui@zjnu.edu.cn>2024-08-07 15:19:26 +0800
committerHui Lan <lanhui@zjnu.edu.cn>2024-08-07 15:19:26 +0800
commitb442a3ddf7f0452e5dd0d8c042a5e155effea154 (patch)
tree6556a965315015d961965f099bdfe1da4e38de8a /Code/update_network.py
parent1c4b5c0208bd8335b685e594b146605e4453722e (diff)
Fix error occurred while running update_network.py
Diffstat (limited to 'Code/update_network.py')
-rwxr-xr-xCode/update_network.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/Code/update_network.py b/Code/update_network.py
index 82c8cb9..376b948 100755
--- a/Code/update_network.py
+++ b/Code/update_network.py
@@ -41,7 +41,6 @@
# Last modified: 10 Sep 2019, hui <lanhui@zjnu.edu.cn> [correlation_mixtools, check the previous R session has finished before starting a new one.]
import os, sys
-import numpy as np
import glob
import time
from datetime import datetime
@@ -130,6 +129,11 @@ def write_sample_size_file(sample_size_file, curr_date, tpm_sample_size):
f.close()
+def empty_file(fname):
+ with open(fname) as f:
+ return f.read().strip() == ''
+
+
def age_of_file_in_days(fname):
''' Return age of fname in days. '''
st = os.stat(fname)
@@ -604,7 +608,7 @@ validate_parameter_for_net(PARAMETER_FOR_NET)
# If the file timestamp does not exist, create one
-if not os.path.exists(TIMESTAMP_FILE):
+if not os.path.exists(TIMESTAMP_FILE) or empty_file(TIMESTAMP_FILE):
record_file_time(FILE_LIST_TO_CHECK, TIMESTAMP_FILE)
# Get update time of mandatory files