I know that with Python 3.8 has been introduced 'dirs_exist_ok=True' argument but I am constrained on Python 3.7 I have tried with no success
shutil.copytree(homePath, dst, symlinks=False, ignore=None)
Is there a way to avoid the exception with 1 line of code?
-
1No, I don't think that is possible. You would need to use the os module, for instance, to check if the path already exists before hand and if not copy it.Cow– Cow2022年08月19日 08:59:58 +00:00Commented Aug 19, 2022 at 8:59
lang-py