kivy/kivy — pull request #2235 by kived (2014-06-05 16:01:54+00:00)
Title: include inner traceback in BuilderException

`BuilderException` tends to hide the problem which caused the actual exception. Some problems require digging through the code and manually tracing it, especially when the exception is occurring in a property callback.

This fixes that by adding the inner traceback to the exception message, which turns this cryptic exception:

````
Traceback (most recent call last):
File "extest.py", line 15, in
''')
File "/home/ryan/git/aeris2/kivy/kivy/lang.py", line 1630, in load_string
self._apply_rule(widget, parser.root, parser.root)
File "/home/ryan/git/aeris2/kivy/kivy/lang.py", line 1814, in _apply_rule
e), cause=tb)
kivy.lang.BuilderException: Parser: File "", line 3:
...
1:
2:MyLabel:
>> 3:	text: '12'
...
NameError: global name 'hello' is not defined
````

...into this:

````
Traceback (most recent call last):
File "extest.py", line 15, in
''')
File "/home/ryan/git/aeris2/kivy/kivy/lang.py", line 1630, in load_string
self._apply_rule(widget, parser.root, parser.root)
File "/home/ryan/git/aeris2/kivy/kivy/lang.py", line 1814, in _apply_rule
e), cause=tb)
kivy.lang.BuilderException: Parser: File "", line 3:
...
1:
2:MyLabel:
>> 3:	text: '12'
...
NameError: global name 'hello' is not defined
File "/home/ryan/git/aeris2/kivy/kivy/lang.py", line 1808, in _apply_rule
setattr(widget_set, key, value)
File "properties.pyx", line 345, in kivy.properties.Property.__set__ (kivy/properties.c:3597)
File "properties.pyx", line 377, in kivy.properties.Property.set (kivy/properties.c:4072)
File "properties.pyx", line 431, in kivy.properties.Property.dispatch (kivy/properties.c:4665)
File "extest.py", line 10, in on_text
print hello
````