python raise filenotfounderror 1

python raise filenotfounderror

import errno
import os

raise FileNotFoundError(
    errno.ENOENT, os.strerror(errno.ENOENT), filename)

Here is what the above code is Doing:
1. It’s raising a FileNotFoundError exception.
2. It’s passing three arguments to the exception:
errno.ENOENT
os.strerror(errno.ENOENT)
filename
3. The first argument is an error number.
4. The second argument is a string error message.
5. The third argument is a filename.

Similar Posts