The next statement in the __iter__ function of the class CSVReader is not inside the for loop. There for a Stopiteration error is not catched. Rewriting the code like this fixes this: ```python def __iter__(self): for (index, line) in enumerate(self.file): if index > 0: timestamp, arbitration_id, extended, remote, error, dlc, data = line.split(',') yield Message( timestamp=float(timestamp), is_remote_frame=(remote == '1'), is_extended_id=(extended == '1'), is_error_frame=(error == '1'), arbitration_id=int(arbitration_id, base=16), dlc=int(dlc), data=b64decode(data), ) self.stop() ```
Activity
bessman commentedon Feb 21, 2020
This is fixed in develop:
python-can/can/io/csv.py
Lines 91 to 96 in b873299
Backport fix for handling empty csv file #771
karlding commentedon May 22, 2020
Closing since the fix is released as part of v3.3.3.