Last active
December 12, 2018 14:08
-
-
Save Bas-Man/01377cbf912b89669c6edcb2b1d51795 to your computer and use it in GitHub Desktop.
Python raise OSError for missing file or invalid path
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if not os.path.exists(self.path): | |
raise OSError( | |
errno.ENOENT, os.strerror(errno.ENOENT), self.path | |
) | |
if not os.path.isfile(self.path + self.file): | |
raise OSError( | |
errno.ENOENT, os.strerror(errno.ENOENT), self.file | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment