BEL-Public/mffpy

Error thrown when adding categories to an mff file

damian5710 opened this issue · 0 comments

Describe the bug

The following error is thrown when attempting to add a category to a Writer instance if the channelStatus attribute is None.

TypeError: 'NoneType' object is not iterable

To Reproduce

from mffpy.writer import Writer

categories = {
    'first category': [
        {
            'status': 'good',
            'name': 'Average',
            'beginTime': 0,
            'endTime': 1200000,
            'evtBegin': 205135,
            'evtEnd': 310153,
            'channelStatus': None,
        }
    ],
}

W = Writer('test.mff')
W.addxml('categories', categories=categories)

Expected behavior

It should be possible to add categories to a Writer instance even if the channelStatus attribute is None.

Additional Context

This bug was found when attempting to create an mff file from an existing segmented file containing an empty channelStatus element in its categories.xml file.