From 643b782a00ae4644af0ac81440896e3e055b240e Mon Sep 17 00:00:00 2001 From: ddelange <14880945+ddelange@users.noreply.github.com> Date: Thu, 17 Oct 2024 10:39:10 +0200 Subject: [PATCH] Prefer name attribute in smart_open_lib --- smart_open/smart_open_lib.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/smart_open/smart_open_lib.py b/smart_open/smart_open_lib.py index 23dd93cb..eed17d9f 100644 --- a/smart_open/smart_open_lib.py +++ b/smart_open/smart_open_lib.py @@ -226,7 +226,7 @@ def open( binary, binary_mode, compression, - filename=uri, + filename=getattr(binary, "name", uri), ) if 'b' not in mode or explicit_encoding is not None: