From c10e3cf05ff87fa6ee4cd16787e0ad9402082253 Mon Sep 17 00:00:00 2001 From: timmahrt Date: Thu, 11 Jun 2015 15:43:27 -0500 Subject: [PATCH] BUGFIX: Was unable to read islev2.txt with trailing newline My custom islev2.txt did not have a trailing newline. --- pysle/isletool.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pysle/isletool.py b/pysle/isletool.py index 0959aac..3a2e5c7 100644 --- a/pysle/isletool.py +++ b/pysle/isletool.py @@ -30,7 +30,8 @@ class LexicalTool(): Builds the isle textfile into a dictionary for fast searching ''' lexDict = {} - wordList = open(self.islePath, "r").read().split("\n") + wordList = [line.rstrip('\n') for line in open(self.islePath, "rU")] + for row in wordList: word, pronunciation = row.split(" ", 1) word = word.split("(")[0]