Martin Panter <vadmium...@gmail.com> 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') as f_in: ... shutil.copyfileobj(f_in, f_out) ... >>> import os >>> os.system("7z l test.txt.gzip") [. . .] Date Time Attr Size Compressed Name ------------------- ----- ------------ ------------ ------------------------ 2018-01-28 22:23:16 ..... 30 34 test.txt ------------------- ----- ------------ ------------ ------------------------ ---------- nosy: +martin.panter _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue32698> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com