uproot.DeserializationError
Defined in uproot.deserialization on line 322.
Inheritance order: |
|---|
|
- class uproot.deserialization.DeserializationError(message, chunk, cursor, context, file_path)
Error raised when a ROOT file cannot be deserialized.
If the first attempt in get failed with predefined uproot.Model classes, this exception is caught and retried with
TStreamerInfo-derived classes, so uproot.DeserializationError sometimes appears in an exception chain two levels deep. (Some ROOT files do have classes that don’t match the standardTStreamerInfo; they may have been produced from private builds of ROOT between official releases.)If a uproot.DeserializationError is caught, the byte stream at the position where it failed can be inspected with
debug
- DeserializationError.debug(skip_bytes=0, limit_bytes=None, dtype=None, offset=0, stream=<_io.TextIOWrapper name='<stdout>' mode='w' encoding='utf-8'>)
- Parameters:
skip_bytes (int) – Number of bytes to skip before presenting the remainder of the uproot.source.chunk.Chunk. May be negative, to examine the byte stream leading up to the attempted deserialization.
limit_bytes (None or int) – Number of bytes to limit the output to. A line of debugging output (without any
offset) is 20 bytes, so multiples of 20 show full lines. If None, everything is shown to the end of the uproot.source.chunk.Chunk, which might be large.dtype (None,
numpy.dtype, or its constructor argument) – If None, present only the bytes as decimal values (0-255). Otherwise, also interpret them as an array of a given NumPy type.offset (int) – Number of bytes to skip before interpreting a
dtype; can be helpful if the numerical values are out of phase with the first byte shown. Not to be confused withskip_bytes, which determines which bytes are shown at all. Anyoffsetvalues that are equivalent modulodtype.itemsizeshow equivalent interpretations.stream (object with a
write(str)method) – Stream to write the debugging output to.
Presents the byte stream at the point where deserialization failed.
Example output with
dtype=">f4"andoffset=3.--+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+- 123 123 123 63 140 204 205 64 12 204 205 64 83 51 51 64 140 204 205 64 { { { ? --- --- --- @ --- --- --- @ S 3 3 @ --- --- --- @ 1.1 2.2 3.3 4.4 --+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+- 176 0 0 64 211 51 51 64 246 102 102 65 12 204 205 65 30 102 102 66 --- --- --- @ --- 3 3 @ --- f f A --- --- --- A --- f f B 5.5 6.6 7.7 8.8 9.9 --+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+- 202 0 0 67 74 0 0 67 151 128 0 123 123 --- --- --- C J --- --- C --- --- --- { { 101.0 202.0 303.0
debug_array
- DeserializationError.debug_array(skip_bytes=0, dtype=dtype('uint8'))
- Parameters:
skip_bytes (int) – Number of bytes to skip before presenting the remainder of the uproot.source.chunk.Chunk. May be negative, to examine the byte stream leading up to the attempted deserialization.
dtype (
numpy.dtypeor its constructor argument) – Data type in which to interpret the data. (The size of the array returned is truncated to thisdtype.itemsize.)
Like debug, but returns a NumPy array for further inspection.
partial_object
- DeserializationError.partial_object
The object, partially filled, which may contain some clues as to what went wrong.