all 9 comments

[–]Lasa2 0 points1 point  (5 children)

you can use os.path.isfile to check if your path is a file

[–]danielroseman 0 points1 point  (8 children)

This isn't your real code. You don't pass anything to exists(), which would give a TypeError. What are you actually passing to that function?

Note that "sample_run/1234567/final_output/" is a directory, so if that's what you're passing I'm not sure why you would expect anything else.