0

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.

asked Mar 19, 2022 at 14:58
2
  • Are you saying that the Python version and the PyInstaller packaged version behave differently with respect to filesystem permissions when run by the same user on the same machine with the same arguments? What is the exact error message that you are seeing? Commented Mar 19, 2022 at 15:44
  • @Chris I will update the question Commented Mar 19, 2022 at 16:05

0

Know someone who can answer? Share a link to this question via email, Twitter, or Facebook.

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.