From b24d05772828a895671c29dfb4f341ea55ee8e58 Mon Sep 17 00:00:00 2001 From: Anthony Zhang Date: Tue, 5 Dec 2017 08:53:30 -0500 Subject: [PATCH] Fix get_segment bug and bump version --- speech_recognition/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/speech_recognition/__init__.py b/speech_recognition/__init__.py index efa104cc..fe197b3e 100644 --- a/speech_recognition/__init__.py +++ b/speech_recognition/__init__.py @@ -22,7 +22,7 @@ import uuid __author__ = "Anthony Zhang (Uberi)" -__version__ = "3.8.0" +__version__ = "3.8.1" __license__ = "BSD" try: # attempt to use the Python 2 modules @@ -311,7 +311,7 @@ def get_segment(self, start_ms=None, end_ms=None): If not specified, ``start_ms`` defaults to the beginning of the audio, and ``end_ms`` defaults to the end. """ assert start_ms is None or start_ms >= 0, "``start_ms`` must be a non-negative number" - assert end_ms is None or end_ms >= start_ms, "``end_ms`` must be a number greater or equal to ``start_ms``" + assert end_ms is None or end_ms >= (0 if start_ms is None else start_ms), "``end_ms`` must be a non-negative number greater or equal to ``start_ms``" if start_ms is None: start_byte = 0 else: