diff --git a/python/podio/frame_iterator.py b/python/podio/frame_iterator.py index 6976ffb43..ec47a43e7 100644 --- a/python/podio/frame_iterator.py +++ b/python/podio/frame_iterator.py @@ -3,8 +3,8 @@ # pylint: disable-next=import-error # gbl is a dynamic module from cppyy from cppyy.gbl import std -from podio.frame import Frame import cppyy +from podio.frame import Frame class FrameCategoryIterator: @@ -32,8 +32,8 @@ def __next__(self): frame_data = self._reader.readNextFrame(self._category) except AttributeError: frame_data = self._reader.readNextEntry(self._category) - except std.runtime_error: - raise StopIteration + except std.runtime_error as error: + raise StopIteration from error if frame_data: return Frame(std.move(frame_data)) @@ -67,9 +67,9 @@ def __getitem__(self, entry): 'points to the library folder of the installation of podio and also to the library ' 'folder with your data model\n') raise - except std.runtime_error: + except std.runtime_error as error: raise IndexError('Unable to read frame, you might be trying to read beyond bounds or a ' - 'non-existent category') + 'non-existent category') from error if frame_data: if isinstance(frame_data, cppyy.gbl.podio.ROOTFrameData): diff --git a/python/podio/root_io.py b/python/podio/root_io.py index e62347dd6..8bfca0f87 100644 --- a/python/podio/root_io.py +++ b/python/podio/root_io.py @@ -3,7 +3,7 @@ from ROOT import gSystem, gInterpreter gSystem.Load('libpodioRootIO') # noqa: E402 -gInterpreter.LoadFile("podio/Reader.h") # noqa: E402 +gInterpreter.LoadFile("podio/Reader.h") # noqa: E402 from ROOT import podio # noqa: E402 # pylint: disable=wrong-import-position from podio.base_reader import BaseReaderMixin # pylint: disable=wrong-import-position @@ -26,6 +26,7 @@ def __init__(self, filenames): super().__init__() + class ROOTFrameReader(BaseReaderMixin): """Reader class for reading podio root files.""" @@ -96,6 +97,7 @@ def __init__(self, filename): self._writer = podio.makeWriter(filename) super().__init__() + class ROOTFrameWriter(BaseWriterMixin): """Writer class for writing podio root files""" def __init__(self, filename): diff --git a/src/RNTupleWriter.cc b/src/RNTupleWriter.cc index dc95e9d15..79360f1e9 100644 --- a/src/RNTupleWriter.cc +++ b/src/RNTupleWriter.cc @@ -63,7 +63,7 @@ void RNTupleWriter::writeFrame(const podio::Frame& frame, const std::string& cat } void RNTupleWriter::writeFrame(const podio::Frame& frame, const std::string& category, - const std::vector& collsToWrite) { + const std::vector& collsToWrite) { auto& catInfo = getCategoryInfo(category); // Use the writer as proxy to check whether this category has been initialized