ligo.segments.utils.from_bitstream raises RuntimeError
The ligo.segments.utils.from_bitstream
function raises a RuntimeError
when executing the documented example on Python >=3.7:
$ /usr/bin/python3 --version
Python 3.9.2
$ /usr/bin/python3 -c "import ligo.segments.utils; list(ligo.segments.utils.from_bitstream((True, True, False, True, False), 0, 1))"
Traceback (most recent call last):
File "/home/duncan/git/ligo-segments/ligo/segments/utils.py", line 377, in from_bitstream
if next(bitstream):
StopIteration
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "<string>", line 1, in <module>
RuntimeError: generator raised StopIteration
On Python 3.6.8 (e.g. /usr/bin/python3
on ldas-pcdev1.ligo.caltech.edu
as of today) this is only a DeprecationWarning
:
$ /usr/bin/python3 --version
Python 3.6.8
$ /usr/bin/python3 -c "import ligo.segments.utils; list(ligo.segments.utils.from_bitstream((True, True, False, True, False), 0, 1))"
-c:1: DeprecationWarning: generator 'from_bitstream' raised StopIteration
The breaking change was introduced by PEP-479 and released first in Python 3.7 as documented in the second bullet of https://docs.python.org/3/whatsnew/3.7.html#changes-in-python-behavior.