Table of Contents

Class FileExistsError

Namespace
NumSharp
Assembly
NumSharp.dll

Python's FileExistsError (errno EEXIST, 17): creating a file or directory that already exists (open(path, 'x'), os.mkdir).

public class FileExistsError : OSError, ISerializable, INumSharpException
Inheritance
FileExistsError
Implements
Inherited Members

Remarks

A subclass of OSError. NumSharp does not raise it itself (its writers truncate, as NumPy's do); Create(int?, string) builds it for errno 17.

Constructors

FileExistsError()

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 FileExistsError()

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.

FileExistsError(int?, string)

Python's OSError(errno, strerror): the message is CPython's [Errno 2] No such file or directory.

public FileExistsError(int? errno, string strerror)

Parameters

errno int?

The operating system's error number, or null for None.

strerror string

Its text (strerror(errno)), or null for None.

Remarks

Builds THIS class whatever the errno; Create(int?, string) picks the subclass the errno names, as Python's call does.

FileExistsError(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 FileExistsError(int? errno, string strerror, string filename)

Parameters

errno int?

The operating system's error number, or null for None.

strerror string

Its text, or null for None.

filename string

The file the operation was on, or null for none (the message then omits it).

FileExistsError(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 FileExistsError(int? errno, string strerror, string filename, int? winerror)

Parameters

errno int?

The error number, or null for None; replaced on Windows when winerror is given.

strerror string

Its text, or null for None.

filename string

The file the operation was on, or null for none.

winerror int?

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.

FileExistsError(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 FileExistsError(int? errno, string strerror, string filename, int? winerror, string filename2)

Parameters

errno int?

The error number, or null for None.

strerror string

Its text, or null for None.

filename string

The first file, or null for none (the second is then dropped, as in CPython).

winerror int?

The Windows error code, or null for None (see the four-argument form).

filename2 string

The second file, or null for none.

FileExistsError(string)

Creates the error with NumPy's message text; every attribute is null, as for Python's OSError('message').

public FileExistsError(string message)

Parameters

message string

The verbatim message (cannot write object arrays to a file in binary mode).

FileExistsError(string, Exception)

Creates the error with NumPy's message text and the exception that caused it; every attribute is null.

public FileExistsError(string message, Exception innerException)

Parameters

message string

The verbatim message.

innerException Exception

The cause (the .NET I/O exception behind a failed write).