diff --git a/pyphen/__init__.py b/pyphen/__init__.py index 84d9f52..64001ea 100755 --- a/pyphen/__init__.py +++ b/pyphen/__init__.py @@ -115,7 +115,8 @@ def __init__(self, path): self.patterns = {} # see "man 4 hunspell", iscii-devanagari is not supported by python - encoding = path.open('rb').readline().decode() + with path.open('rb') as fd: + encoding = fd.readline().decode() if encoding.lower() == 'microsoft-cp1251': encoding = 'cp1251'