[issue32698] Improper gzip compression if output file extension is not "gz"

2018-01-29 Thread Adrien
Adrien added the comment: Thanks @martin.panter for your response. I will close this issue as "not a bug" as there is a workaround and as the current behavior could be deduced by reading carefully the entire documentation. -- resolution: -> not a bug stage: -> resolved status: open

[issue32698] Improper gzip compression if output file extension is not "gz"

2018-01-28 Thread Martin Panter
Martin Panter added the comment: According to the documentation, you can use the lower-level GzipFile constructor’s “filename” argument: >>> with open(output_path, 'wb') as f_out, \ ... gzip.GzipFile(fileobj=f_out, mode='wb', filename=input_path) as f_out, \ ... open(input_path, 'rb')

[issue32698] Improper gzip compression if output file extension is not "gz"

2018-01-28 Thread Adrien
New submission from Adrien : Hello. The following code produces a improper compressed "test.txt.gzip" file: import gzip import shutil input_path = "test.txt" output_path = input_path + ".gzip" with open(input_path, 'w') as file: file.write("abc" * 10)