From b6e0dbe8a0660573fd48bf792d19b6abbd74166f Mon Sep 17 00:00:00 2001 From: Arun Chandra Boini Date: Thu, 12 Oct 2023 12:20:49 +0530 Subject: [PATCH] fix: OSError is generated by os.rename #22 --- src/adobe/pdfservices/operation/internal/io/file_ref_impl.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/adobe/pdfservices/operation/internal/io/file_ref_impl.py b/src/adobe/pdfservices/operation/internal/io/file_ref_impl.py index 8ff58ac..2953671 100644 --- a/src/adobe/pdfservices/operation/internal/io/file_ref_impl.py +++ b/src/adobe/pdfservices/operation/internal/io/file_ref_impl.py @@ -12,6 +12,7 @@ import logging import os from io import BufferedWriter +from shutil import move from adobe.pdfservices.operation.exception.exceptions import SdkException from adobe.pdfservices.operation.internal.constants.service_constants import ServiceConstants @@ -45,7 +46,7 @@ def save_as(self, destination_file_path): if not os.path.exists(dir): os.mkdir(dir) if not os.path.exists(abs_path): - os.rename(self._file_path, abs_path) + move(self._file_path, abs_path) return raise SdkException("Output file {file} exists".format(file=destination_file_path)) else: