Skip to content

FileAccessError(operation, path, reason) Source

Bases: NumdaplotError, OSError

Raised when a file cannot be read or written: missing folder, missing permission, full disk and so on.

It is also a Python OSError. A missing file and an existing file have their own errors, FileNotFoundError and FileExistsError.

Added in version 0.1.0

Parameters:

  • operation (str)

    What was attempted: "read" or "write to".

  • path (str)

    The path of the file.

  • reason (str)

    Why it failed.

Attributes:

  • operation

    What was attempted: "read" or "write to".

  • path

    The path of the file.

  • reason

    Why it failed.

Examples:

import numdaplot as ndp

prices = ndp.Table.from_arrays({"price": ndp.Array.from_list([1.5])})
try:
    prices.to_csv("missing_folder/prices.csv")
except ndp.FileAccessError as error:
    print(error)
# Cannot write to missing_folder/prices.csv: the folder missing_folder does not exist.