I have written a code to copy the directory tree structure to another folder using Python:
try:
shutil.copytree(srcfolder, dstfolder, ignore = shutil.ignore_patterns(IGNORE_EXTENSIONS))
except shutil.Error as exc:
errors = exc.args[0]
for error in errors:
src, dst, msg = error
print(src + " --> "+ dst)
The script works fine and gives no issues. So I converted the script to one file exe so that I can transfer it on systems:
pyinstaller -F -c "C:/Users/CopyOnly.py"
The exe created works fine but now it gives exception in copying certain files. Please let me know how to resolve this issue.
I have already gone through this thread: Handling exception while using shutil.copytree to copy a file where permission is denied
But it is not my solution. I want that the exe should work exactly the same as like the script. Let me know your thoughts.
Python version 3.7.9.
[Updated] Error I receive while using the Exe is:
[WinError 5] Access is denied: 'C:\\Users\\data\\Math 3D Morpher\\Textures\\checker.bmp'
Now this never arrives while working with the script. just by using the python copyscript.py
.