-
Notifications
You must be signed in to change notification settings - Fork 298
Closed
Description
In knitpy I use the kernel to check if code lines are "complete" (e.g. in python the line which starts a loop is "incomplete"):
msg = engine.kernel.is_complete(lines+"\n\n")
reply = engine.kernel.get_shell_msg(timeout=self.timeout)
assert reply['msg_type'] == 'is_complete_reply', str(reply)
if self.kernel_debug:
self.log.debug("completion_request: %s", msg)
if reply['content']['status'] == 'complete':
[...]
# run the lines
self._run_lines(lines+"\n", context)
lines = ""
elif reply['content']['status'] == 'invalid':
# TODO: not sure how this should be handled
# Either abort execution of the whole file or just retry with the next line?
# However this should be handled via a user message
self.log.info("Code invalid:\n%s", lines)
lines = ""
else:
# the "incomplete" case: don't run anything wait for the next line
lines += "\n"
This doesn't work with the r kernel, as it seems that message is unhandled and the get_shell_msg times out with an Exception :-(
Please implement the message :-)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels