filestat.py optimized and IO error handling implemented by error.py