PermissionError: [Errno 13] Permission denied @ PYTHON
<p>i am trying to copy a file from one folder to another, but i am getting "PermissionError: [Errno 13] Permission denied". I am working within my home directory and i am the administrator of the PC. Went through many other previous posts .. tried all the options that are to my knowledge (newbie to programming) ... need some help.</p>

<pre><code>import os
import shutil

src = "C:\\Users\\chzia\\Scripts\\test" # the file lab.txt is in this folder that needs to be copied to testcp folder.
dst = "C:\\Users\\chzia\\Scripts\\testcp"

for file in os.listdir(src):
  src_file = os.path.join(src, file)
  dst_file = os.path.join(dst, file)
  #shutil.copymode(src, dst) # i have tried these options too same error
  #shutil.copyfile(src, dst) # i have tried these options too same error
  shutil.copy(src, dst)
</code></pre>

<p>My target is to create an .exe that copies a file from the network location to a specific folder on a pc where the .exe is run.
Thanks in advance for all the support and help. </p>

<p>Perhaps try to use shutil.copyfile instead:</p>

<pre><code>shutil.copyfile(src, dst)
</code></pre>

<p>Similar old topic on <a href="http://stackoverflow.com/questions/11835833/why-would-shutil-copy-raise-a-permission-exception-when-cp-doesnt">Why would shutil.copy() raise a permission exception when cp doesn&#39;t?</a></p>

python shutil