python – kopiar una carpeta and ottra ruta mostrando el progreso in QProgressBar

Estoy intentando copiar la carpeta Src_School_Admin que se encuentra en la ruta: C: Users Angel Desktop Proyecto a la carpeta school administration

Sin embargo no function Lanza el siguiente error:

Traceback (last call last):
File "C: Users Angel Desktop Proyecto setup_install.py", line 16, in progress
Self-copy ()
File "C: Users Angel Desktop Proyecto setup_install.py", line 21, in copy
source = open (self.origen, "rb")
Permission Error: [Errno 13] Permission Denied: & # 39; C: / Users / Angel / Desktop / Proyecto
Src_School_Admin & # 39;

Y la QProgressBar no progress in the future:

archivo.py

from PyQt5.QtWidgets imports QMainWindow, QApplication, QMessageBox
import from PyQt5, QtCore
import shutil, os
Import platform
Import threading

Class CopyThread (QtCore.QThread):
procDone = QtCore.pyqtSignal (bool)
procPartDone = QtCore.pyqtSignal (int)

def __init __ (self, origen, destino):
QtCore.QThread .__ init__ (self)
self.origen = origen
self.destino = destino
def run (self):
Self-copy ()
self.procDone.emit (True)
def copy (self):
source_size = os.stat (self.origen) .st_size
copied = 0
source = open (self.origen, "rb")
Goal = open (self.destino, "wb")

while true:
chunk = source.read (1024)
if not piece:
break
target.write (chunk)
copied + = len (chunk)
self.procPartDone.emit (copied * 100 / source_size)
source.close ()
target.close ()

Class MessageError (threading.Thread):
def __init __ (self, obj):
threading.Thread .__ init __ (self)
self.obj = obj

def run (self):
QtCore.QMetaObject.invokeMethod (self.obj, "onError")
QtCore.Qt.QueuedConnection,
QtCore.Q_ARG (str, "critical access"),
QtCore.Q_ARG (str, " nEste programa solo puede ejecutarse DE Administrador.  N  nInfo:  nAlsegurese de programe de Administrador  n"))

Class Install (QMainWindow):
def __init __ (self):
QMainWindow .__ init__ (self)
uic.loadUi ("Dialog_Install.ui", itself)

self.setWindowFlags (QtCore.Qt.FramelessWindowHint)

self.BClose.clicked.connect (self.Info)
self.BIniciar.pressed.connect (self.Button_Effect_start)
self.BIniciar.released.connect (self.Button_Effect_End)
self.progressBar.hide ()



def info (self):

respuesta = QMessageBox.question (None, "Salir", "Desea finalize la intalaciĆ³n del programa  t")
If respuesta == QMessageBox.Yes:
self.close ()

def Button_Effect_start (self):
animacion = QtCore.QPropertyAnimation (self.BIniciar, b "size")
animacion.setDuration (100)
animacion.setStartValue (QtCore.QSize (138,28))
animacion.setEndValue (QtCore.QSize (138,28))
animacion.start ()

def Button_Effect_End (self):
animacion = QtCore.QPropertyAnimation (self.BIniciar, b "size")
animacion.setDuration (100)
animacion.setStartValue (QtCore.QSize (141,31))
animacion.setEndValue (QtCore.QSize (141,31))
animacion.start ()
self.BIniciar.hide ()
self.progressBar.show ()
self.LEstado.setText ("copiando archivos" + str (self.progressBar.value ()) + "%")
self.label_5.setText ("Instalando")
self.LEstado.setText ("Creando directorio")
t = threading.Thread (target = self.Ubicacion)
t.start ()

def Ubicacion (self):

arquitectura = platform.architecture ()

target = "Src_School_Admin"
initial_dir = & # 39; C: \ & # 39;
Path = & # 39; & # 39;

for root, _, files in os.walk (initial_dir):

if target in root:
path = os.path.join (root)
break


If os.path.exists (& # 39; C: \ Program Files \ SchoolAdministration & # 39;) exists:
shutil.rmtree (& # 39; C: \ Program Files \ School Administration & # 39;)
otherwise:
shutil.copytree (str (path) .replace (& # 39; \ & # 39 ;, & # 39; / & 39;), & # 39; C: \ Program \ School Administration & # 39;)
self.LEstado.setText (& # 39; Archivo copiado & # 39;)
self.copy1 (path)


def copy1 (self, path):
origen = path.replace ("\", & # 39; / & # 39;
print (origen)
destino = & # 39; C: \ Program Files \ School Administration & # 39;
self.copy_thread = CopyThread (Origen, Destino)
self.copy_thread.procPartDone.connect (self.update_progress)
self.copy_thread.procDone.connect (self.finished_copy)
self.copy_thread.start ()
def update_progress (self, progress):
self.progressBar.setValue (progress)
def ended_copy (self, state):
self.close ()


@QtCore.pyqtSlot (str, str)
def onError (proper name, title, text):
QMessageBox.critical (None, Title, Text)
self.close ()

app = QApplication ([])
i = Install ()
I show()
app.exec_ ()

Dialog_install.ui



 main window
 
  
   
    0
    0
    638
    433
   
  
  
   main window
  
  
   Background: # 2A2E30;
  
  
   
    
     
      600
      0
      41
      31
     
    
    
     
      Arial
      11
      75
      true
     
    
    
     QPushButton # BClose {
Background: none;
Limit: 0px;
Color white;
}

    
    
     X
    
   
   
    
     
      30
      30
      81
      81
     
    
    
     Background: none;
    
    
     
    
    
     Src_School_Admin / Img / Logo.png
    
    
     true
    
   
   
    
     
      120
      40
      121
      21
     
    
    
     
      11
      75
      true
     
    
    
     Color: # 4253F4;
Background: none;
    
    
     school administration
    
   
   
    
     
      120
      60
      201
      21
     
    
    
     
      10
      75
      true
     
    
    
     Color: # 424D99;
Background: none;
    
    
     School Management System
    
   
   
    
     
      5
      410
      201
      21
     
    
    
     
      8th
      50
      not correct
     
    
    
     Color gray;
Background: none;
    
    
     2019 v 0.1 Beta - Rev.1.0
    
   
   
    
     
      250
      270
      141
      31
     
    
    
     
      9
      75
      true
     
    
    
     QPushButton # BIniciar {
Color white;
Background: qlineargradient (Spread: Pad, x1: 0,475435, y1: 0, x2: 0,495, y2: 1, Stop: 0gba (66, 83, 224, 255), stop: 1gba (66, 77, 153, 255 )));
Limit: 0px;
}
QPushButton # BIniciar: hover {
Background: qlineargradient (Spread: Pad, x1: 0,509, y1: 1, x2: 0,506299, y2: 0, Stop: 0gba (66, 83, 224, 255), stop: 1gba (66, 77, 153, 255 )));
}
    
    
     instalar
    
   
   
    
     
      250
      190
      141
      20
     
    
    
     
      11
      75
      true
     
    
    
     Color: light gray;
    
    
     Bienvenido
    
    
     Qt :: AlignCenter
    
   
   
    
     
      20
      280
      601
      23
     
    
    
     QProgressBar # progressBar :: horizontal {
Limit: 0px;
Background: gray;
}
QProgressBar # progressBar :: chunk {
Limit: 0px;
Background color: q linear gradient (Propagation: Pad, x1: 1, y1: 0.54, x2: 0, y2: 0.5, stop: 0 rgba (45, 116, 185, 193), Stop: 1 rgba (26, 44 , 53) 255));
}
    
    
     0
    
    
     not correct
    
    
     not correct
    
   
   
    
     
      240
      320
      171
      21
     
    
    
     
      9
      50
      not correct
     
    
    
     Color: # 4253F4;
Background: none;
    
    
     
    
    
     Qt :: AlignCenter
    
   
  
 
 
 

esperado
The bus stop is near the main shop of Carpeta Src_School_Admin que contiene otros archives a la nueva carpeta school administration