Open
Description
metakernel/metakernel/replwrap.py
Line 243 in 2de5d37
I've been using this to wrap a python interpreter and have come across the issue that the run_command
code doesn't distinguish between a hard continuation where a statement is missing a body e.g.
if true:
and a soft continuation where a statement could contain more in its body:
if true:
print("hi")
This results in the value error being raised each time a nested statement is used.
To solve the issue in Python the code can be modified to:
if self._expect_prompt(timeout=timeout) == 1:
# Try and resolve the continuation
self.sendline("")
if self._expect_prompt(timeout=timeout) == 1:
# We got the continuation prompt - command was incomplete
self.interrupt(continuation=True)
raise ValueError("Continuation prompt found - input was incomplete:\n" + command)
Perhaps this could be added as an option on the class?
Metadata
Assignees
Labels
No labels
Activity