From 8b7c7ba214fdd6b84d61e0e798d5ea63861894e2 Mon Sep 17 00:00:00 2001 From: Guillaume Ayoub Date: Mon, 29 May 2017 17:58:09 +0200 Subject: [PATCH] Use shutil.move in export_storage os.rename doesn't work when the two folders are on different partitions. shutil.move calls os.rename when possible. --- radicale/__main__.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/radicale/__main__.py b/radicale/__main__.py index 3a60390e..f27ad54d 100644 --- a/radicale/__main__.py +++ b/radicale/__main__.py @@ -26,6 +26,7 @@ from a python programme with ``radicale.__main__.run()``. import atexit import os +import shutil import sys import optparse import signal @@ -90,7 +91,7 @@ def export_storage(config, path): with open(component_filename, "wb") as f: f.write(text.encode("utf-8")) try: - os.rename(os.path.join(temp, "root"), path) + shutil.move(os.path.join(temp, "root"), path) except OSError as e: print("ERROR: Can't create '%s' directory: %s" % (path, e)) exit(1)