try/except around os.stat instead of checking if the file exists @coryvirok