Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ class LiteDisplayHook(DisplayHook):
def __init__(self, *args, **kwargs):
super(LiteDisplayHook, self).__init__(*args, **kwargs)
self.publish_execution_result = None
self.publish_execution_error = None

def start_displayhook(self):
self.data = {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,12 @@ def enable_gui(self, gui=None):
pass

def _showtraceback(self, etype, evalue, stb):
sys.stdout.flush()
sys.stderr.flush()
dh = self.displayhook
if dh.publish_execution_error:
dh.publish_execution_error(str(etype), str(evalue), stb)

self._last_traceback = {
"ename": str(etype),
"evalue": str(evalue),
Expand Down
3 changes: 2 additions & 1 deletion packages/pyodide-kernel/src/worker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ ${e.stack}`;
const bundle = {
ename: ename,
evalue: evalue,
traceback: traceback,
traceback: this.formatResult(traceback),
};

this._sendWorkerMessage({
Expand Down Expand Up @@ -363,6 +363,7 @@ ${e.stack}`;
this._interpreter.display_pub.update_display_data_callback =
updateDisplayDataCallback;
this._interpreter.displayhook.publish_execution_result = publishExecutionResult;
this._interpreter.displayhook.publish_execution_error = publishExecutionError;
this._interpreter.input = this.input.bind(this);
this._interpreter.getpass = this.getpass.bind(this);

Expand Down
Loading