bonjour,

je développe un programme orienté dans le traitement de fichier pour les renommer il déplace et vide tout le contenu du dossier source sans le supprimer et impossible de le supprimé par la suite ou de le déplacé... j'ai toujours un message d'erreur de la part de Windows.
---
Nom : Capture.PNG
Affichages : 340
Taille : 4,3 Ko
---

bon bonne nouvelle il disparaît quand je redemande le pc mais je veux pas avoir a le redémarré a chaque fois que j'ai fait mes traitement de fichier !

voici le code:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
if self.choix.get() == '1':
      x=open('C:/Users/lekev262/Downloads/[M] Manga scan/[0] scan/manga {0}.html'.format(ch),'w')
      x.write('<HTML>\n<P ALIGN="CENTER">\n')
      for i in range(0,len(self.fichier)):
        x.write('<IMG SRC="{0}/p{1}.jpg"><br>\n'.format(ch,i+1))
        os.renames(self.name[i],'C:/Users/lekev262/Downloads/[M] Manga scan/[0] scan/{0}/p{1}.jpg'.format(ch,i+1))     
      x.write("</P>\n</HTML>\n")
      x.close()
    elif self.checkButtonsInputsValues.get() == 1 and self.choix.get() == '2':
      for i in range(0,len(self.fichier)): os.renames(self.name[i],'C:/Users/lekev262/Downloads/[M] Manga scan/{0}/{0} [T{1}] p{2}.jpg'.format(self.manga,ch,i+1))
    elif self.checkButtonsInputsValues.get() == 0 and self.choix.get() == '2':
      for i in range(0,len(self.fichier)): os.renames(self.name[i],'C:/Users/lekev262/Downloads/[M] Manga scan/{0}/{0} ch{1} p{2}.jpg'.format(self.manga,ch,i+1))
    else:
      x=open('C:/Users/lekev262/Downloads/[M] Manga scan/[0] scan/{0} {1}.html'.format(self.manga,ch),'w')
      x.write('<HTML>\n<P ALIGN="CENTER">\n')
      for i in range(0,len(self.fichier)):
        x.write('<IMG SRC="{0}/{1}/p{2}.jpg"><br>\n'.format(self.manga,ch,i+1))
        os.renames(self.name[i],'C:/Users/lekev262/Downloads/[M] Manga scan/[0] scan/{0}/{1}/p{2}.jpg'.format(self.manga,ch,i+1))
      x.write("</P>\n</HTML>\n")
      x.close()      
    ch=int(ch)+1
    if askquestion('Suppretion', 'Êtes-vous sûr de vouloir faire ça?'):
      try: os.rmdir('{0}'.format(os.path.dirname(self.name[0])))# me donne une erreur quant je les utilises 
      except: os.shutil.rmtree('{0}'.format(os.path.dirname(self.name[0])))
erreur :
Exception in Tkinter callback
Traceback (most recent call last):
File "E:\Anime - Image\appli maison\nouveau\programe TK.py", line 115, in executer
try: os.rmdir('{0}'.format(os.path.dirname(self.name[0])))
PermissionError: [WinError 5] Accès refusé: 'C:/Users/lekev262/Downloads/[M] Manga scan/[Penguin-Scantrad]Mushoku_Tensei_~Isekai_Ittara_Honki_Dasu~_v02_c15'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "C:\Python34\lib\tkinter\__init__.py", line 1533, in __call__
return self.func(*args)
File "E:\Anime - Image\appli maison\nouveau\programe TK.py", line 116, in executer
except: os.shutil.rmtree('{0}'.format(os.path.dirname(self.name[0])))
AttributeError: 'module' object has no attribute 'shutil'
c'est un problème de os.renames ? ou un conflit quelle conque ?

merci de votre aide.