cutadapt
cutadapt copied to clipboard
Fix bug in report.py when dealing with empty list
cutseq report this error when eranges is None.
File ".micromamba/lib/python3.12/site-packages/cutadapt/report.py", line 246, in as_json
self._adapter_statistics_as_json(
File ".micromamba/lib/python3.12/site-packages/cutadapt/report.py", line 302, in _adapter_statistics_as_json
"error_lengths": make_line(eranges),
^^^^^^^^^^^^^^^^^^
TypeError: 'NoneType' object is not iterable
close https://github.com/marcelm/cutadapt/issues/804
How did you trigger this? Would be good to have a test as well.
Oh, you’re calling _adapter_statistics_as_json with one_line=False.
Your suggested fix is not correct because error_lengths needs to be null when not available as documented.
I think the correct fix is to change:
make_line = OneLine if one_line else list
to
make_line = OneLine if one_line else lambda x: x