uproot.KeyInFileError

Defined in uproot.exceptions on line 16.

Inheritance order:

  1. builtins.KeyError

  2. builtins.LookupError

  3. builtins.Exception

  4. builtins.BaseException

class uproot.exceptions.KeyInFileError(key, because='', cycle=None, keys=None, file_path=None, object_path=None)

Exception raised by attempts to find ROOT objects in TDirectories or TBranches in uproot.behaviors.TBranch.HasBranches, which both have a Python Mapping interface (square bracket syntax to extract items).

This exception descends from Python’s KeyError, so it can be used in the normal way by interfaces that expect a missing item in a Mapping to raise KeyError, but it provides more information, depending on availability:

  • because: an explanatory message

  • cycle: the ROOT cycle number requested, if any

  • keys: a list or partial list of keys that are in the object, in case of misspelling

  • file_path: a path (or URL) to the file

  • object_path: a path to the object within the ROOT file.