FileNotFoundError: [Errno 2] No such file or directory
Bonjour,
j'ai cette erreur sur le fichier : '/home/daniel/.kde/socket-fixe'
bien que ce dernier existe.
Traceback (most recent call last):
File "/home/daniel/svtincr-copie.py", line 39, in <module>
datemodif = time.ctime(os.stat(chemin).st_mtime)
FileNotFoundError: [Errno 2] No such file or directory: '/home/daniel/.kde/socket-fixe'
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
|
print("debut lecture ssource",time.asctime(now))
folder_path = "/home/daniel"
n =0
for path, dirs, files in os.walk(folder_path):
for filename in files:
chemin = path + "/" + filename
print(chemin)
datemodif = time.ctime(os.stat(chemin).st_mtime)
datemodif = time.strptime(datemodif, "%a %b %d %H:%M:%S %Y")
nomsource.append(filename)
ficdat = (time.strftime("%Y/%m/%d-%H:%M:%S",(datemodif)))
datesource.append(ficdat)
dest = (chemin + " ! " + ficdat)
fichiersource.append(dest)
lensvt= len(fichiersvt)
lensource = len(fichiersource)
print(lensvt,lensource)
now = time.localtime(time.time())
print("debut traitement",time.asctime(now)) |
Merci pour votre aide : je ne comprend pas la raison de l'erreur.
Cordialement
Systeme Ubuntu 16.04 64 bits : Python 3.5.2