Crash when using SerafinFile to write a SELAFIN file with no records
Summary
When the HERMES Python API is not available and using SerafinFile
instead, a crash occurs when writing a SELAFIN file with no records.
Environment
- Operating System: all
- TELEMAC version: main
Steps to reproduce
Compile TELEMAC without the HERMES Python API and start vnv_hermes.py
from $HOMETEL/examples/python3/TelApy_hermes
:
validate_telemac.py vnv_hermes.py
What is the current bug behaviour?
An exception occurs with triforce_no_var.slf
.
What is the expected correct behaviour?
It should work flawlessly.
Relevant logs and/or screenshots
Traceback (most recent call last):
File "/home/user/telemac/examples/python3/TelApy_hermes/test_telemac_file.py", line 200, in <module>
main()
File "/home/user/telemac/examples/python3/TelApy_hermes/test_telemac_file.py", line 172, in main
create_file_from_scratch('triforce_no_var.slf')
File "/home/user/telemac/examples/python3/TelApy_hermes/test_telemac_file.py", line 61, in create_file_from_scratch
res.close()
File "/home/user/telemac/scripts/python3/data_manip/formats/serafin_file.py", line 416, in close
self.__write()
File "/home/user/telemac/scripts/python3/data_manip/formats/serafin_file.py", line 377, in __write
for itime, time in enumerate(self.__times):
^^^^^^^^^^^^^^^^^^^^^^^
TypeError: 'NoneType' object is not iterable
Traceback (most recent call last):
File "/home/user/telemac/scripts/python3/validate_telemac.py", line 827, in <module>
sys.exit(main())
^^^^^^
File "/home/user/telemac/scripts/python3/validate_telemac.py", line 807, in main
run_validation_python_mpi(cfg, options, report, xcpts)
File "/home/user/telemac/scripts/python3/validate_telemac.py", line 174, in run_validation_python_mpi
run_python(py_file, options, report, xcpts)
File "/home/user/telemac/scripts/python3/validate_telemac.py", line 506, in run_python
raise exc
File "/home/user/telemac/scripts/python3/validate_telemac.py", line 473, in run_python
my_vnv_study.run()
File "/home/user/telemac/scripts/python3/vvytel/vnv_study.py", line 711, in run
ret = subprocess.check_call(command['cmd'], shell=True,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/subprocess.py", line 413, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command 'python3 test_telemac_file.py' returned non-zero exit status 1.