From 460107abaa05cf0bfb51098e68c868171a0d57b0 Mon Sep 17 00:00:00 2001 From: Dmitri Bogomolov <4glitch@gmail.com> Date: Sat, 7 Oct 2017 15:50:25 +0300 Subject: [PATCH] Handled AttributeError when tr imported from plugin --- src/tr.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/tr.py b/src/tr.py index 19c234a1..cf7f16ac 100644 --- a/src/tr.py +++ b/src/tr.py @@ -17,7 +17,11 @@ def _translate(context, text, disambiguation = None, encoding = None, n = None): return translateText(context, text, n) def translateText(context, text, n = None): - if not shared.thisapp.daemon: + try: + is_daemon = shared.thisapp.daemon + except AttributeError: # inside the plugin + is_daemon = False + if not is_daemon: try: from PyQt4 import QtCore, QtGui except Exception as err: