mirror of
https://github.com/ail-project/ail-framework.git
synced 2024-11-30 01:37:17 +00:00
fix: [core Global] catch and log incomplete files
This commit is contained in:
parent
6b6c6a4d9e
commit
fc58940ed6
1 changed files with 7 additions and 2 deletions
|
@ -114,9 +114,14 @@ if __name__ == '__main__':
|
||||||
print('File already exist {}'.format(filename))
|
print('File already exist {}'.format(filename))
|
||||||
publisher.warning('Global; File already exist')
|
publisher.warning('Global; File already exist')
|
||||||
|
|
||||||
|
try:
|
||||||
|
with gzip.open(filename, 'rb') as f:
|
||||||
|
curr_file_content = f.read()
|
||||||
|
except EOFError:
|
||||||
|
publisher.warning('Global; Incomplete file: {}'.format(filename))
|
||||||
|
# discard item
|
||||||
|
continue
|
||||||
|
|
||||||
with gzip.open(filename, 'rb') as f:
|
|
||||||
curr_file_content = f.read()
|
|
||||||
curr_file_md5 = hashlib.md5(curr_file_content).hexdigest()
|
curr_file_md5 = hashlib.md5(curr_file_content).hexdigest()
|
||||||
|
|
||||||
new_file_content = gunzip_bytes_obj(decoded)
|
new_file_content = gunzip_bytes_obj(decoded)
|
||||||
|
|
Loading…
Reference in a new issue