Closed rotcx closed 8 months ago
case: 2107.00630v6
fix:
## bugfix: ValueError: ZIP does not support timestamps before 1980 import time def zipdir(dir, output_path): # ziph is zipfile handle zipf = zipfile.ZipFile(output_path, 'w', zipfile.ZIP_DEFLATED) for file in loop_files(dir): rel_path = os.path.relpath(file, dir) # 检查并修复文件时间戳 timestamp = os.path.getmtime(file) if timestamp < time.mktime((1980, 1, 1, 0, 0, 0, 0, 0, 0)): os.utime(file, (time.mktime((1980, 1, 1, 0, 0, 0, 0, 0, 0)), time.mktime((1980, 1, 1, 0, 0, 0, 0, 0, 0)))) zipf.write(file, arcname=rel_path) zipf.close() def zipdir0(dir, output_path): # ziph is zipfile handle zipf = zipfile.ZipFile(output_path, 'w', zipfile.ZIP_DEFLATED) for file in loop_files(dir): rel_path = os.path.relpath(file, dir) zipf.write(file, arcname=rel_path)
case: 2107.00630v6
fix:![image](https://github.com/SUSYUSTC/MathTranslate/assets/4511865/e268daaf-6b9a-4d2a-845b-ecca8202c223)