Untitled
unknown
plain_text
3 years ago
607 B
9
Indexable
# Compress the output file and remove the uncompressed file
output_file_name = output_file.name
new_output_file_name = output_file_name.replace('.txt', '-cassandra.log')
os.rename(output_file_name, new_output_file_name)
try:
with open(new_output_file_name, 'rb') as input_file, gzip.open(new_output_file_name + '.gz', 'wb') as output_file_gz:
input_data = input_file.read()
output_file_gz.write(input_data)
os.remove(new_output_file_name)
# Set permissions on the output file
os.chmod(output_file_gz.name, 0o777)Editor is loading...