As the First state of the next execution is Completely wrong, the ensuing computation is also Mistaken. Because eventually the second execution will update the ultimate state with the wrong result.If you're on Python two, it is possible to backport the pathlib module from pypi, pathlib2, or in any other case check isfile within the os.route module: