using  path.isfile instead of path.exists