Class EOFError
- Namespace
- NumSharp
- Assembly
- NumSharp.dll
Python's EOFError: a read that hit the end of its input with nothing to read. NumSharp raises it where
NumPy does: np.load on an empty file, or past the last array of a file that holds several
(No data left in file).
public class EOFError : EndOfStreamException, ISerializable, INumSharpException
- Inheritance
-
EOFError
- Implements
- Inherited Members
Remarks
It derives from .NET's EndOfStreamException, the exception with the same meaning (and through it
IOException), so a catch (EndOfStreamException) or catch (IOException) written for
.NET code catches it. Python's EOFError is NOT an OSError, and NumSharp's is not an
OSError either: catch (OSError) misses it, as except OSError does.
A loop that reads arrays from one stream until the end (while True: np.load(f)) ends on this error, in
both languages.
Constructors
EOFError()
Creates the error with Python's text for a bare raise EOFError: an empty
Message, as str(EOFError()) is '' (not .NET's
EndOfStreamException default, "Unable to read beyond the end of the stream.").
public EOFError()
Remarks
ToString() then starts with the class name alone, as Python's traceback prints a
bare EOFError.
EOFError(string)
Creates the error with NumPy's message.
public EOFError(string message)
Parameters
messagestringThe text, verbatim: Python's
str()of the error (No data left in file).
EOFError(string, Exception)
Creates the error with a message and the exception that caused it: Python's raise EOFError(message) from
innerException, the cause kept in InnerException as Python keeps it in
cause.
public EOFError(string message, Exception innerException)
Parameters
messagestringThe text, verbatim: Python's
str()of the error.innerExceptionExceptionThe exception that led to this one (the .NET reader's EndOfStreamException, for example), or null for none.