Prevent from error when decoding key phrases

This commit is contained in:
Gregory Soutade 2017-01-29 09:12:47 +01:00
parent 4b5fee00e4
commit 038e485081
1 changed files with 5 additions and 1 deletions

View File

@ -112,7 +112,11 @@ class IWLAPostAnalysisReferers(IPlugin):
groups = key_phrase_re.match(p)
if groups:
key_phrase = groups.groupdict()['key_phrase']
key_phrase = urllib.unquote_plus(key_phrase).decode('utf8')
try:
key_phrase = urllib.unquote_plus(key_phrase).decode('utf8')
except Exception, e:
print(e)
continue
if not key_phrase in key_phrases.keys():
key_phrases[key_phrase] = 1
else: