From 81aaaa8a8c4282db31bb9aa125db55ef71e26664 Mon Sep 17 00:00:00 2001 From: sans Date: Thu, 1 Sep 2022 17:03:26 +0200 Subject: [PATCH] it seems this is a useful change (compress.py) --- compress_logger/compress.py | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/compress_logger/compress.py b/compress_logger/compress.py index f7ca2f0..4622afd 100644 --- a/compress_logger/compress.py +++ b/compress_logger/compress.py @@ -78,6 +78,7 @@ def treat(action, instrument='', years='past', vars=None): logbase = '%slogger/' % instdir(instrument) gzbase = '%sgzlogger/' % instdir(instrument) os.chdir(logbase) + print('chdir', logbase, gzbase) if years == 'all': yrs = list(glob('20*')) elif years == 'past': @@ -97,18 +98,19 @@ def treat(action, instrument='', years='past', vars=None): else: varlist = vars for variable in varlist: - # print logdir+variable - if os.path.isdir(logdir+variable): - if action == COMPRESS: + if action == COMPRESS: + if os.path.isdir(logdir+variable): if not os.path.isfile(gzdir + variable + '.gz'): t0 = time.time() compress(logdir, gzdir, variable) time.sleep(min(1.0, time.time()-t0)) # be nice - elif action == EXPAND: - if os.path.isfile(gzdir + variable + '.gz'): - expand(logdir, gzdir, variable) - else: - print '%s is missing' % (gzdir + variable + '.gz') + elif action == EXPAND: + os.makedirs(logdir+variable) + print(gzdir, variable, '.gz') + if os.path.isfile(gzdir + variable + '.gz'): + expand(logdir, gzdir, variable) + else: + print '%s is missing' % (gzdir + variable + '.gz') if __name__ == '__main__': action = COMPRESS