key4hep/k4FWCore

Errors in steering files are not easy to find

jmcarcell opened this issue · 1 comments

Currently if there is any error in the steering file the traceback looks like this:

Traceback (most recent call last):
  File "/cvmfs/sw-nightlies.hsf.org/key4hep/releases/2023-09-29/x86_64-centos7-gcc12.2.0-opt/k4fwcore/198f3383c8a170ab964d2ee2819c3edb6773ed02=develop-dyison/bin/k4run", line 129, in <module>
    load_file(file)
  File "/cvmfs/sw-nightlies.hsf.org/key4hep/releases/2023-09-29/x86_64-centos7-gcc12.2.0-opt/k4fwcore/198f3383c8a170ab964d2ee2819c3edb6773ed02=develop-dyison/bin/k4run", line 26, in load_file
    exec(file.read(), {})
  File "<string>", line 20, in <module>
  File "/cvmfs/sw-nightlies.hsf.org/key4hep/releases/2023-09-03/x86_64-centos7-gcc12.2.0-opt/gaudi/36.14-tq6q3o/python/GaudiKernel/Configurable.py", line 517, in __setattr__
    super(Configurable, self).__setattr__(name, value)
  File "/cvmfs/sw-nightlies.hsf.org/key4hep/releases/2023-09-03/x86_64-centos7-gcc12.2.0-opt/gaudi/36.14-tq6q3o/python/GaudiKernel/PropertyProxy.py", line 145, in __set__
    value = _isCompatible(proptype, value)
  File "/cvmfs/sw-nightlies.hsf.org/key4hep/releases/2023-09-03/x86_64-centos7-gcc12.2.0-opt/gaudi/36.14-tq6q3o/python/GaudiKernel/PropertyProxy.py", line 66, in _isCompatible
    raise ValueError(errmsg)
ValueError: received an instance of <class 'int'>, but <class 'list'> expected

and while the line in the steering file that caused the error can be extracted (in this case line 20), it's not evident. Ideally the trackeback messages should look more like normal python traceback messages that point you to the line that caused the issue.

may be possible if we import the steering file as a module similar to how its done in FCCAnalyses. I wanted to try that but did not have the time...