replacing os.rename() by shutil.move in ifcpatch

This commit is contained in:
Benoit DAMAY
2024-03-12 09:58:40 +01:00
parent aec751b762
commit df478f6ed7
+3 -1
View File
@@ -19,6 +19,7 @@
# along with IfcPatch. If not, see <http://www.gnu.org/licenses/>. # along with IfcPatch. If not, see <http://www.gnu.org/licenses/>.
import os import os
import shutil
import ifcopenshell import ifcopenshell
import logging import logging
import typing import typing
@@ -99,7 +100,8 @@ def write(output: Union[ifcopenshell.file, str], filepath: str) -> None:
return return
elif isinstance(output, str): elif isinstance(output, str):
if os.path.exists(output): if os.path.exists(output):
os.rename(output, filepath) print('DEBUG shutil')
shutil.move(output, filepath)
else: else:
with open(filepath, "w") as text_file: with open(filepath, "w") as text_file:
text_file.write(output) text_file.write(output)