File size: 699 Bytes
ab88106
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# -*- coding: utf-8 -*-
# file: test.py
# time: 23:21 2023/1/27
# author: yangheng <[email protected]>
# github: https://github.com/yangheng95
# huggingface: https://huggingface.co/yangheng
# google scholar: https://scholar.google.com/citations?user=NPq5a_0AAAAJ&hl=en
# Copyright (C) 2021. All Rights Reserved.

def fixBadZipfile(zipFile):
 f = open(zipFile, 'r+b')
 data = f.read()
 pos = data.find('\x50\x4b\x05\x06') # End of central directory signature
 if (pos > 0):
     f.seek(pos + 22)   # size of 'ZIP end of central directory record'
     f.truncate()
     f.close()
 else:
     pass


if __name__ == '__main__':
    fixBadZipfile('RealESRGANv030/weights/RealESRGAN_x4plus_anime_6B.zip')