The short version:
How do I show the content of the call stack on the client?
Some context:
Sometimes a function is executed and I don’t know why.
Importing traceback on the client side doesn’t work:
NotImplementedImportError: traceback is not yet implemented in Skulpt
A trick that allows me to see what called that function is to add something like print(1/0)
, so I can see the stack and understand what called that function.
The problem with this trick (beside being pretty ugly) is that it can’t be used if there is some catch all try-except
(which shouldn’t be used, but, you know…)
I tried calling this, but it only shows the server side stack, nothing from the client side:
@anvil.server.callable
def show_traceback():
import traceback
print('\n'.join(str(i) for i in traceback.extract_stack()))
Skulpt is able to show the stack, because it does show it when there is an error.