Check the root
variable. You might be looking for the file at ./access_log-20150215
that is actually in a subdirectory such as ./subdir/access_log-20150215
.
If you want to explore all subdirectories use
f=open(os.path.join(root,file),'r')
but if you only want the top directory you can use
os.listdir('.')
3
solved Python script looking for nonexistent file