Skip to content
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
10 changes: 7 additions & 3 deletions pygmt/clib/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -379,10 +379,14 @@ def print_func(file_pointer, message): # noqa: ARG001
We'll capture the messages and print them to stderr so that they will show
up on the Jupyter notebook.
"""
message = message.decode().strip()
# Have to use try..except due to upstream GMT bug in GMT <= 6.5.0.
# See https://github.com/GenericMappingTools/pygmt/issues/3205.
try:
message = message.decode().strip()
except UnicodeDecodeError:
return 0
self._error_log.append(message)
# flush to make sure the messages are printed even if we have a
# crash.
# Flush to make sure the messages are printed even if we have a crash.
print(message, file=sys.stderr, flush=True) # noqa: T201
return 0

Expand Down