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.

Jaffer Wilson
  • 7,029
  • 10
  • 62
  • 139
  • 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? – ChrisGPT was on strike Mar 19 '22 at 15:44
  • @Chris I will update the question – Jaffer Wilson Mar 19 '22 at 16:05

0 Answers0