Pregunta

I simplified the problem. Now I have only this code:

files = os.listdir(dir_path)
print(files)

for f in files:
    info = os.stat(f)
    print(info.st_mtime)

Which gives me this error:

OSError: [Errno 2] No such file or directory: anyfile.txt

And print(files) is returning the files which I want. Why can't I access to their properties?

Thank you in advance, I am a bit lost with this point.

¿Fue útil?

Solución

Ok, I got the solution... I only had to change this line:

info = os.stat(dir_path + f)

What a waste of time! Sorry for my stupid question!

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top