GenericMappingTools / pygmt

A Python interface for the Generic Mapping Tools.
https://www.pygmt.org
BSD 3-Clause "New" or "Revised" License
769 stars 222 forks source link

launch_external_viewer: Use full path when opening the file in a web browser #3647

Closed seisman closed 4 days ago

seisman commented 5 days ago

When opening a file via webbrowser.open_new_tab, we use the file URI with the format: file://{fname}. Here fname must be a full path, as shown below.

In [1]: import webbrowser

In [2]: webbrowser.open_new_tab("basemap.pdf")
Out[2]: True

In [3]: webbrowser.open_new_tab("file://basemap.pdf")
Out[3]: True

In [4]: gio: file://basemap.pdf: Operation not supported

This PR fixes the bug.