Fix Windows PermissionError in get_llama_cpp() by using shutil.move instead of pathlib.replace
This commit is contained in:
1 parent
f32577e3c2
commit
b45c40be6a
1 file changed
+3
-1
@@ -404,7 +404,9 @@ def get_llama_cpp():
|
||||
f.extractall(tmp)
|
||||
top = next(tmp.iterdir())
|
||||
shutil.rmtree(llama, ignore_errors=True)
|
||||
top.replace(llama)
|
||||
# pathlib.Path.replace() can fail on Windows with PermissionError
|
||||
# when file handles or AV locks persist; use shutil.move instead.
|
||||
shutil.move(str(top), str(llama.parent))
|
||||
shutil.rmtree(tmp, ignore_errors=True)
|
||||
z.unlink(missing_ok=True)
|
||||
z.with_name(z.name + ".done").unlink(missing_ok=True)
|
||||
|
||||
Reference in new issue
Block a user