Skip to content

Commit

Permalink
add print remote
Browse files Browse the repository at this point in the history
  • Loading branch information
Quentin Peter committed Jun 22, 2023
1 parent af324a2 commit 67dceeb
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions spyder_kernels/console/kernel.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ def __init__(self, *args, **kwargs):
'request_pdb_stop': self.shell.request_pdb_stop,
'raise_interrupt_signal': self.shell.raise_interrupt_signal,
'get_fault_text': self.get_fault_text,
'print_remote': self.print_remote,
}
for call_id in handlers:
self.frontend_comm.register_call_handler(
Expand Down Expand Up @@ -967,3 +968,14 @@ def post_handler_hook(self):
self.shell.register_debugger_sigint()
# Reset tracing function so that pdb.set_trace works
sys.settrace(None)

def print_remote(self, text, file_name=None):
"""Remote print"""
file = None
if file_name == "stdout":
file = sys.stdout
elif file_name == "stderr":
file = sys.stderr
print(text, file=file)
if file:
file.flush()

0 comments on commit 67dceeb

Please sign in to comment.