Skip to content

PlotFileError

PlotFileError(message: str)

Bases: ggrust.errors.GgrustError, builtins.ValueError

Raised when a .ggrs plot file cannot be opened.

The file is not a ggrust plot file, was written by a newer ggrust, or is damaged: an entry is missing, too large, or does not match the SHA-256 hash recorded when it was saved. The message names the file and the entry.

Parameters:

  • message (str) –

    The full message.

Examples:

>>> import os, tempfile
>>> from ggrust import ggload
>>> from ggrust.errors import PlotFileError
>>> path = os.path.join(tempfile.mkdtemp(), "notes.ggrs")
>>> with open(path, "w") as file:
...     _ = file.write("not a plot")
>>> try:
...     ggload(path)
... except PlotFileError:
...     print("not a plot file")
not a plot file