Author iritkatriel
Recipients danny87105, eryksun, iritkatriel
Date 2020-09-21.22:02:39
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1600725759.48.0.89167589862.issue41737@roundup.psfhosted.org>
In-reply-to
Content
The documentation for open says "If the file cannot be opened, an OSError is raised."

NotADirectoryError and FileNotFoundError are both OSErrors.

So the correct way to write Danny's code snippet, according to the documentation, is:

    try:
        open('/path/to/file/somename.txt')
    except OSError:
        """do something"""
History
Date User Action Args
2020-09-21 22:02:39iritkatrielsetrecipients: + iritkatriel, eryksun, danny87105
2020-09-21 22:02:39iritkatrielsetmessageid: <1600725759.48.0.89167589862.issue41737@roundup.psfhosted.org>
2020-09-21 22:02:39iritkatriellinkissue41737 messages
2020-09-21 22:02:39iritkatrielcreate