bb.msg.error(bb.msg.domain.Util, line)
raise
-def better_exec(code, context, text, realfile):
+def better_exec(code, context, text, realfile = "<code>"):
"""
Similiar to better_compile, better_exec will
print the lines that are responsible for the
error.
"""
import bb.parse
+ if not hasattr(code, "co_filename"):
+ code = better_compile(code, realfile, realfile)
try:
exec(code, _context, context)
except:
raise
# print the Header of the Error Message
- bb.msg.error(bb.msg.domain.Util, "There was an error when executing a python function in: %s" % realfile)
+ bb.msg.error(bb.msg.domain.Util, "There was an error when executing a python function in: %s" % code.co_filename)
bb.msg.error(bb.msg.domain.Util, "Exception:%s Message:%s" % (t, value))
# Strip 'us' from the stack (better_exec call)