fixes to compress scripts

This commit is contained in:
2026-02-09 11:22:08 +01:00
parent 09c017cd2d
commit 30fcb9fda9
2 changed files with 8 additions and 8 deletions

View File

@@ -7,17 +7,17 @@ import shutil
import time
def zcat_compress(gzfile, files):
with gzip.open(gzfile+'z', 'wo') as out:
out.write('ZCAT')
with gzip.open(gzfile+'z', 'wb') as out:
out.write(b'ZCAT')
n = 0
for filename in files:
with open(filename) as f:
with open(filename, 'rb') as f:
content = f.read()
if re.match(r'#20\d\d-\d\d-\d\d ', content) is None:
if re.match(rb'#20\d\d-\d\d-\d\d ', content) is None:
print('%s is not a sea log file' % filename)
os.rename(filename, filename + ".bad")
else:
out.write("\n%d %s\n" % (len(content), filename))
out.write(b"\n%d %s\n" % (len(content), filename.encode('utf-8')))
out.write(content)
n += 1
os.rename(gzfile+'z', gzfile)

View File

@@ -2,8 +2,8 @@
cd ${0:h}
set inst=${HOME:t}
echo $inst
python compress.py -a
python3 compress.py -a
cd ..
tar -cf ${inst}_sea_logger.tar gzlogger
scp ${inst}_sea_logger.tar l_samenv@samenv.psi.ch:sea/logger_tar/
scp ${inst}_sea_logger.tar zolliker@ldmzolliker.psi.ch:Desktop/logger_tar/
scp ${inst}_sea_logger.tar l_samenv@linse-c.psi.ch:sea/logger_tar/
#scp ${inst}_sea_logger.tar zolliker@ldmzolliker.psi.ch:Desktop/logger_tar/