-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathdecompress.py
More file actions
31 lines (24 loc) · 866 Bytes
/
decompress.py
File metadata and controls
31 lines (24 loc) · 866 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import os
from loguru import logger
from sc_compression import decompress
from xcoder.localization import locale
def decompress_csv():
folder = "./CSV/In-Compressed"
folder_export = "./CSV/Out-Decompressed"
for file in os.listdir(folder):
if file.endswith(".csv"):
try:
with open(f"{folder}/{file}", "rb") as f:
file_data = f.read()
with open(f"{folder_export}/{file}", "wb") as f:
f.write(decompress(file_data)[0])
except Exception as exception:
logger.exception(
locale.error
% (
exception.__class__.__module__,
exception.__class__.__name__,
exception,
)
)
print()