diff --git a/powerline/lint/__init__.py b/powerline/lint/__init__.py index 00b20318..05108d57 100644 --- a/powerline/lint/__init__.py +++ b/powerline/lint/__init__.py @@ -598,9 +598,14 @@ def check_segment_name(name, data, context, echoerr): func = getattr(__import__(unicode(module), fromlist=[unicode(name)]), unicode(name)) except ImportError: echoerr(context='Error while checking segments (key {key})'.format(key=context_key(context)), - problem='failed to import function {0} from module {1}'.format(name, module), + problem='failed to import module {0}'.format(module), problem_mark=module.mark) return True, False, True + except AttributeError: + echoerr(context='Error while loading segment function (key {key})'.format(key=context_key(context)), + problem='failed to load function {0} from module {1}'.format(name, module), + problem_mark=match_name.mark) + return True, False, True if not callable(func): echoerr(context='Error while checking segments (key {key})'.format(key=context_key(context)), diff --git a/powerline/lint/markedjson/reader.py b/powerline/lint/markedjson/reader.py index 7c8a7b91..47b99362 100644 --- a/powerline/lint/markedjson/reader.py +++ b/powerline/lint/markedjson/reader.py @@ -8,10 +8,9 @@ from .error import MarkedError, Mark, NON_PRINTABLE import codecs try: - from __builtin__ import unicode, unichr + from __builtin__ import unicode except ImportError: unicode = str # NOQA - unichr = chr # NOQA class ReaderError(MarkedError):