Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update execution_count before running cell #119

Merged
merged 1 commit into from
Feb 21, 2017
Merged
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
8 changes: 8 additions & 0 deletions jupyter_console/ptshell.py
Original file line number Diff line number Diff line change
Expand Up @@ -358,6 +358,10 @@ def _(event):
b.newline()
return

# Pressing enter flushes any pending display. This also ensures
# the displayed execution_count is correct.
self.handle_iopub()

more, indent = self.check_complete(d.text)

if (not more) and b.accept_action.is_returnable:
Expand Down Expand Up @@ -663,6 +667,10 @@ def handle_iopub(self, msg_id=''):
msg_type = sub_msg['header']['msg_type']
parent = sub_msg["parent_header"]

# Update execution_count in case it changed in another session
if msg_type == "execute_input":
self.execution_count = int(sub_msg["content"]["execution_count"]) + 1

if self.include_output(sub_msg):
if msg_type == 'status':
self._execution_state = sub_msg["content"]["execution_state"]
Expand Down