From 7dd5b609de907f72d09048260e06a19ef608dace Mon Sep 17 00:00:00 2001 From: Chrys Date: Thu, 29 Aug 2019 18:08:22 +0200 Subject: [PATCH] replace replace by sub --- src/fenrirscreenreader/core/punctuationManager.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/fenrirscreenreader/core/punctuationManager.py b/src/fenrirscreenreader/core/punctuationManager.py index f7c6bfb6..767d62ae 100644 --- a/src/fenrirscreenreader/core/punctuationManager.py +++ b/src/fenrirscreenreader/core/punctuationManager.py @@ -38,8 +38,10 @@ class punctuationManager(): resultText = str(text) if customDict: for key,item in customDict.items(): - #resultText = resultText.replace(str(key),seperator + str(item) + seperator) - resultText = re.sub(str(key), seperator + str(item) + seperator, resultText) + try: + resultText = re.sub(str(key), seperator + str(item) + seperator, resultText) + except: + resultText = resultText.replace(str(key),seperator + str(item) + seperator) return resultText def usePunctuationDict(self, text, punctuationDict, punctuation): resultText = str(text)