Hey list, I hope you can help me with this. I'm having an issue with handling errors within lua code. What I'm trying to do is: from __future__ import absolute_import, print_function, unicode_literals from lupa import LuaRuntime l = LuaRuntime() l.execute(''' function do_something_that_fails() error('lua error happened') end local function _print_traceback(err) print(debug.traceback(err, 2)) end function do_protected() return xpcall(function () do_in_python() end, _print_traceback) end ''') l.globals().do_in_python = lambda: l.globals().do_something_that_fails() l.globals().do_protected() The corresponding output is: [string "<python>"]:14: error during Python call stack traceback: [C]: in function 'do_in_python' [string "<python>"]:14: in function <[string "<python>"]:13> [C]: in function 'xpcall' [string "<python>"]:13: in function <[string "<python>"]:12> Traceback (most recent call last): File "local/lupa_test.py", line 29, in <module> l.globals().do_protected() File "_lupa.pyx", line 327, in lupa._lupa._LuaObject.__call__ (lupa/_lupa.c:5319) File "_lupa.pyx", line 963, in lupa._lupa.call_lua (lupa/_lupa.c:13506) File "_lupa.pyx", line 971, in lupa._lupa.execute_lua_call (lupa/_lupa.c:13617) File "_lupa.pyx", line 154, in lupa._lupa.LuaRuntime.reraise_on_exception (lupa/_lupa.c:3210) File "_lupa.pyx", line 1060, in lupa._lupa.py_call_with_gil (lupa/_lupa.c:14447) File "_lupa.pyx", line 1054, in lupa._lupa.call_python (lupa/_lupa.c:14344) File "local/lupa_test.py", line 27, in <lambda> l.globals().do_in_python = lambda: l.globals().do_something_that_fails() File "_lupa.pyx", line 327, in lupa._lupa._LuaObject.__call__ (lupa/_lupa.c:5319) File "_lupa.pyx", line 963, in lupa._lupa.call_lua (lupa/_lupa.c:13506) File "_lupa.pyx", line 973, in lupa._lupa.execute_lua_call (lupa/_lupa.c:13636) File "_lupa.pyx", line 924, in lupa._lupa.raise_lua_error (lupa/_lupa.c:12990) lupa._lupa.LuaError: [string "<python>"]:3: lua error happened The desired behavior would be that the lua function do_protected would handle the error that was reported by do_something_that_fails. It looks like the error handling is interrupted by the call to the python function do_in_python and converted into an exception though. So all the lua code can see is that "something happened within python". I would like to have the first lua function would see the entire traceback. How can I achieve this? Thanks for any advice! Cheers, Arthur