From 3e131d9f2ee72af372646c0ab577d0f9b663ad53 Mon Sep 17 00:00:00 2001 From: dece Date: Sat, 3 Sep 2022 20:21:51 +0200 Subject: [PATCH] fix renaming issue --- shrlok/shrlok.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/shrlok/shrlok.py b/shrlok/shrlok.py index 47412ab..5e01370 100644 --- a/shrlok/shrlok.py +++ b/shrlok/shrlok.py @@ -126,10 +126,10 @@ def write_content(data: bytes, name: str = "", extension: str = ""): os.chmod(output_file.name, 0o644) file_name = output_file.name if name: - new_file_name = os.path.join(os.path.dirname(file_name), name) + old_file_name = file_name + file_name = os.path.join(os.path.dirname(old_file_name), name) try: - os.rename(file_name, name) - file_name = new_file_name + os.rename(old_file_name, file_name) except OSError as exc: print(f"Failed to give required name to the file: {exc}") return None