Question

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.

Was it helpful?

Solution

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!

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top