Class PermissionError
- Namespace
- NumSharp
- Assembly
- NumSharp.dll
Python's PermissionError (errno EACCES 13, EPERM 1): an operation the operating system
denies. NumSharp's file functions raise it as CPython's open() does: a read-only or locked file opened for
writing, a file another process holds without sharing, and on Windows a directory opened as a file
([Errno 13] Permission denied: 'data').
public class PermissionError : OSError, ISerializable, INumSharpException
- Inheritance
-
PermissionError
- Implements
- Inherited Members
Remarks
A subclass of OSError; footgun: NOT .NET's UnauthorizedAccessException, which is not an IOException either. The .NET exception behind it is its InnerException.
Constructors
PermissionError()
Creates the error with Python's text for a bare raise OSError: an empty
Message, as str(OSError()) is '' (not .NET's
IOException default, "I/O error occurred."); every attribute is null.
public PermissionError()
Remarks
ToString() then starts with the class name alone, as Python's traceback prints a
bare OSError; prefer a message that names the file and the operation.
PermissionError(int?, string)
Python's OSError(errno, strerror): the message is CPython's [Errno 2] No such file or
directory.
public PermissionError(int? errno, string strerror)
Parameters
errnoint?The operating system's error number, or null for
None.strerrorstringIts text (
strerror(errno)), or null forNone.
Remarks
Builds THIS class whatever the errno; Create(int?, string) picks the subclass the errno names, as Python's call does.
PermissionError(int?, string, string)
Python's OSError(errno, strerror, filename): the message is CPython's [Errno 2] No such file or
directory: 'x.npy', the file name as Python's repr() quotes it.
public PermissionError(int? errno, string strerror, string filename)
Parameters
errnoint?The operating system's error number, or null for
None.strerrorstringIts text, or null for
None.filenamestringThe file the operation was on, or null for none (the message then omits it).
PermissionError(int?, string, string, int?)
Python's OSError(errno, strerror, filename, winerror): on Windows, winerror (a Windows
error code, or an HRESULT carrying one) decides errno through CPython's
winerror_to_errno, and the message reads [WinError 5] Access is denied: 'f'.
public PermissionError(int? errno, string strerror, string filename, int? winerror)
Parameters
errnoint?The error number, or null for
None; replaced on Windows whenwinerroris given.strerrorstringIts text, or null for
None.filenamestringThe file the operation was on, or null for none.
winerrorint?The Windows error code, or null for
None.
Remarks
Footgun, CPython's own: on Windows a four- or five-argument call prints [WinError None] even when
winerror is null; elsewhere winerror is ignored (CPython parses it and
drops it) and winerror stays null.
PermissionError(int?, string, string, int?, string)
Python's OSError(errno, strerror, filename, winerror, filename2): an operation on two files, the message
naming both ([Errno 17] File exists: 'a' -> 'b'; on Windows [WinError …]).
public PermissionError(int? errno, string strerror, string filename, int? winerror, string filename2)
Parameters
errnoint?The error number, or null for
None.strerrorstringIts text, or null for
None.filenamestringThe first file, or null for none (the second is then dropped, as in CPython).
winerrorint?The Windows error code, or null for
None(see the four-argument form).filename2stringThe second file, or null for none.
PermissionError(string)
Creates the error with NumPy's message text; every attribute is null, as for Python's
OSError('message').
public PermissionError(string message)
Parameters
messagestringThe verbatim message (
cannot write object arrays to a file in binary mode).
PermissionError(string, Exception)
Creates the error with NumPy's message text and the exception that caused it; every attribute is null.
public PermissionError(string message, Exception innerException)