diff --git a/pattern/text/__init__.py b/pattern/text/__init__.py index aa77af0b..44517287 100644 --- a/pattern/text/__init__.py +++ b/pattern/text/__init__.py @@ -605,8 +605,11 @@ def _read(path, encoding="utf-8", comment=";;;"): line = decode_utf8(line, encoding) if not line or (comment and line.startswith(comment)): continue - yield line - raise StopIteration + try: + yield line + except StopIteration: + return + return class Lexicon(lazydict):