mirror of
https://github.com/powerline/powerline.git
synced 2025-07-29 16:55:07 +02:00
Handle AttributeError also when importing segment function
This commit is contained in:
parent
1ef1ad7cfe
commit
fe6f1bf4d5
@ -598,9 +598,14 @@ def check_segment_name(name, data, context, echoerr):
|
|||||||
func = getattr(__import__(unicode(module), fromlist=[unicode(name)]), unicode(name))
|
func = getattr(__import__(unicode(module), fromlist=[unicode(name)]), unicode(name))
|
||||||
except ImportError:
|
except ImportError:
|
||||||
echoerr(context='Error while checking segments (key {key})'.format(key=context_key(context)),
|
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)
|
problem_mark=module.mark)
|
||||||
return True, False, True
|
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):
|
if not callable(func):
|
||||||
echoerr(context='Error while checking segments (key {key})'.format(key=context_key(context)),
|
echoerr(context='Error while checking segments (key {key})'.format(key=context_key(context)),
|
||||||
|
@ -8,10 +8,9 @@ from .error import MarkedError, Mark, NON_PRINTABLE
|
|||||||
import codecs
|
import codecs
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from __builtin__ import unicode, unichr
|
from __builtin__ import unicode
|
||||||
except ImportError:
|
except ImportError:
|
||||||
unicode = str # NOQA
|
unicode = str # NOQA
|
||||||
unichr = chr # NOQA
|
|
||||||
|
|
||||||
|
|
||||||
class ReaderError(MarkedError):
|
class ReaderError(MarkedError):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user