Have you tried it with a proper function?

The underlying error handling in pythonista is different in the console vs a file (in a file, the graphical error popup is shown, while in the console it just prints the error). Calling a function from the console is also different than using settrace -- since the latter sets the underlying cpython trace mechanism, which might expect a valid function.