Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

what are the all of the "causes" for an IOerror

From Python Docs

exception IOError

Raised when an I/O operation (such as a print statement, the built-in open() function or a method of a file object) fails for an
I/O-related reason, e.g., “file not found” or “disk full”.

There seems that there is no enumeration of reasons documented on the internet.

IOErrors seem to be place to put exception about io that no other place to live. I am curious what are all (at least all of the common reasons) for IOErrors.

Lets start with the assumption of access to a file like environment (filesystem that has the concept of files.) with finite space on it (a hard drive (magnetic media) with 10 Gigabytes).

This question isn't python specific, really, but I need a starting point.

like image 972
jamesldurham Avatar asked Nov 30 '25 16:11

jamesldurham


1 Answers

According to the Python Docs, the IOError is an alias of the OSError. In other words, the IOError is actually the OSError, so let's take a look at what the Python docs say about the OSError:

This exception is raised when a system function returns a system-related error, including I/O failures such as “file not found” or “disk full” (not for illegal argument types or other incidental errors).

Note: The above statement is true for Python 3.3 and up.

Sources:

  • Regarding the IOError being an alias of the OSError: https://docs.python.org/3/library/exceptions.html#IOError

Note: If you click on the above link, you must scroll up a little to see the text talking about the IOError being an alias to the OSError.

  • About the OSError: https://docs.python.org/3/library/exceptions.html#OSError
like image 50
David M. Helmuth Avatar answered Dec 02 '25 04:12

David M. Helmuth



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!