def addItem(self, sourcePath, destPath, pmAttributes): import ntpath dirName, fileName = ntpath.split(sourcePath) self.items.append([sourcePath, destPath, pmAttributes]) if os.path.exists(destPath): wigetItem = QListWidgetItem(fileName) wigetItem.sourcePath = sourcePath wigetItem.destPath = destPath wigetItem.pmAttributes = pmAttributes self.w_list.addItem(wigetItem) self.w_msg.setText( '%d Items aleady exists at \n[%s] \nDo you want to replace it?' % (self.w_list.count(), os.path.dirname(destPath)))