Browse Source

os.move doesn't work between filesystems. Replaced with a fix that works

Alex Selimov 1 year ago
parent
commit
48e9835b5f
1 changed files with 3 additions and 1 deletions
  1. 3 1
      ical2vdir/__init__.py

+ 3 - 1
ical2vdir/__init__.py

@@ -19,6 +19,7 @@ import argparse
 import datetime
 import logging
 import os
+import shutil
 import pathlib
 import sys
 import tempfile
@@ -104,7 +105,8 @@ def _write_event(event: icalendar.cal.Event, path: pathlib.Path) -> None:
         os.write(temp_fd, event.to_ical())
         os.close(temp_fd)
         # python3.5 expects Union[bytes, str]
-        os.rename(temp_path, str(path))
+        shutil.copy(temp_path, str(path))
+        os.remove(temp_path)
     finally:
         if os.path.exists(temp_path):
             os.unlink(temp_path)