This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author danny87105
Recipients danny87105, eryksun, iritkatriel
Date 2020-10-20.13:54:40
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1603202081.28.0.223373371019.issue41737@roundup.psfhosted.org>
In-reply-to
Content
By writing "except FileNotFoundError:", the intention is to catch an error when the file being opened is not found, and don't catch an error for other cases, such as an existing file without adequate permission. Writing "except OSError:" catches just too much cases including unwanted ones.

As they are not equivalent, you cannot say that the latter is the "correct" way for the former.

And you totally omitted the argument for the inadequate documentation for NotADirectoryError. It says NotADirectoryError is raises when a DIRECTORY operation is requested, and does not cover the case of opening a file.
History
Date User Action Args
2020-10-20 13:54:41danny87105setrecipients: + danny87105, eryksun, iritkatriel
2020-10-20 13:54:41danny87105setmessageid: <1603202081.28.0.223373371019.issue41737@roundup.psfhosted.org>
2020-10-20 13:54:41danny87105linkissue41737 messages
2020-10-20 13:54:40danny87105create