A
A
aab1372018-09-06 15:58:27
Python
aab137, 2018-09-06 15:58:27

PermissionError: [Errno 13] Permission denied. What to do?

The code:

import zipfile, os
import shutil
a = os.listdir(path="D:\домашка\G_ Arhangelskiy_-_Time_Draive\G_ Arhangelskiy_-_Time_Draive")
for i in a:
    s='D:\домашка\G_ Arhangelskiy_-_Time_Draive\G_ Arhangelskiy_-_Time_Draive\\'+str(i)
    b = os.listdir(path=s)
    for j in b:
        s1 = 'D:\домашка\G_ Arhangelskiy_-_Time_Draive\G_ Arhangelskiy_-_Time_Draive\\'+i+'\\'+j
        shutil.copyfile(s1, "D:\домашка\G_ Arhangelskiy_-_Time_Draive\G_ Arhangelskiy_-_Time_Draive — копия")
    os.remove('D:\домашка\G_ Arhangelskiy_-_Time_Draive\G_ Arhangelskiy_-_Time_Draive\\'+i)

Mistake:
Traceback (most recent call last):
  File "C:\Users\Alex\PycharmProjects\untitled\из папок.py", line 9, in <module>
    shutil.copyfile(s1, "D:\домашка\G_ Arhangelskiy_-_Time_Draive\G_ Arhangelskiy_-_Time_Draive — копия")
  File "C:\Users\Alex\AppData\Local\Programs\Python\Python36\lib\shutil.py", line 115, in copyfile
    with open(dst, 'wb') as fdst:
PermissionError: [Errno 13] Permission denied: 'D:\\домашка\\G_ Arhangelskiy_-_Time_Draive\\G_ Arhangelskiy_-_Time_Draive — копия'

What to do?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question