Skip to content

Commit b4344f7

Browse files
committed
os.rename giving me oserror
os.rename si giving the following error OSError: [Errno 18] Invalid cross-device link Recommended module use is shutil and shutil.move function. Have only tried it on Linux.
1 parent a744775 commit b4344f7

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

‎src/wikmd/utils.py‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import os
22
import unicodedata
33
import re
4+
import shutil
45

56
_filename_ascii_strip_re = re.compile(r"[^A-Za-z0-9 _.-]")
67
_windows_device_files = {
@@ -73,4 +74,4 @@ def move_all_files(src_dir: str, dest_dir: str):
7374
new_file += f".{file_split[1]}" # add the extension
7475
copies_count += 1
7576

76-
os.rename(f"{src_dir}/{file}", f"{dest_dir}/{new_file}")
77+
shutil.move(f"{src_dir}/{file}", f"{dest_dir}/{new_file}")

0 commit comments

Comments
 (0)