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

Patch the callback print function to suppress the UnicodeDecodeError #3367

Merged
merged 2 commits into from
Aug 5, 2024

Conversation

seisman
Copy link
Member

@seisman seisman commented Aug 4, 2024

Description of proposed changes

See #3205 for the original issue and GenericMappingTools/gmt#8461 for the upstream fix.

We can do nothing for old GMT versions but the UnicodeDecodeError error in debugging messages looks scaring. So at least we should catch the exception to suppress the error.

No UnicodeDecodeError error after this PR:

In [1]: import pygmt

In [2]: pygmt.config(GMT_VERBOSE="d")
gmtset [DEBUG]: gmtlib_get_graphics_item: Fig: 0 Subplot: 2 Panel: () Inset: 0
Out[2]: <pygmt.src.config.config at 0x13c8b8e90>

In [3]: fig = pygmt.Figure()
pygmt-session [DEBUG]: Exit:  gmt_reload_settings
pygmt-session [DEBUG]: Enter: gmtlib_plot_C_format
pygmt-session [DEBUG]: Exit:  gmtlib_plot_C_format
pygmt-session [DEBUG]: Enter: gmtinit_get_history
pygmt-session [DEBUG]: gmtlib_get_graphics_item: Fig: 0 Subplot: 2 Panel: () Inset: 0
pygmt-session [DEBUG]: Initialize FFTW with 8 threads.
pygmt-session [DEBUG]: GMT_Create_Session initialized GMT structure
pygmt-session [DEBUG]: Shared Library # 0 (core). Path = /Users/seisman/opt/miniconda/envs/pygmt/lib/libgmt.dylib
pygmt-session [DEBUG]: Loading GMT plugins from: /Users/seisman/opt/miniconda/envs/pygmt/lib/gmt/plugins
pygmt-session [DEBUG]: Shared Library # 1 (supplements). Path = /Users/seisman/opt/miniconda/envs/pygmt/lib/gmt/plugins/supplements.so
pygmt-session [DEBUG]: GMT now running in modern mode [Session ID = 13594]
pygmt-session [DEBUG]: Revised options: 03e3017e1ead48cc8d003fcbd5e98b9f -
figure [DEBUG]: No figure file /Users/seisman/.gmt/sessions/gmt_session.13594/gmt.figures - nothing to do
figure [DEBUG]: New figure: 1	03e3017e1ead48cc8d003fcbd5e98b9f	-

@seisman seisman added maintenance Boring but important stuff for the core devs needs review This PR has higher priority and needs review. run/test-gmt-dev Trigger the GMT Dev Tests workflow in PR labels Aug 4, 2024
@seisman seisman added this to the 0.13.0 milestone Aug 4, 2024
@seisman
Copy link
Member Author

seisman commented Aug 4, 2024

The failures in the "GMT Dev Tests" CI are likely caused by shapely dev issue shapely/shapely#2098.

@seisman seisman removed needs review This PR has higher priority and needs review. run/test-gmt-dev Trigger the GMT Dev Tests workflow in PR labels Aug 5, 2024
@seisman seisman merged commit 8859ca3 into main Aug 5, 2024
15 of 21 checks passed
@seisman seisman deleted the printfunc branch August 5, 2024 02:05
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
maintenance Boring but important stuff for the core devs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants