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/helpers/utils.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Utilities and common tasks for wrapping the GMT modules.
"""
import os
import shutil
import subprocess
import sys
Expand Down Expand Up @@ -195,8 +196,9 @@ def launch_external_viewer(fname):
"""
Open a file in an external viewer program.

Uses the ``xdg-open`` command on Linux, the ``open`` command on macOS, and
the default web browser on other systems.
Uses the ``xdg-open`` command on Linux, the ``open`` command on macOS, the
associated application on Windows, and the default web browser on other
systems.

Parameters
----------
Expand All @@ -214,8 +216,10 @@ def launch_external_viewer(fname):
subprocess.run(["xdg-open", fname], check=False, **run_args)
elif os_name == "darwin": # Darwin is macOS
subprocess.run(["open", fname], check=False, **run_args)
elif os_name == "win32":
os.startfile(fname) # pylint: disable=no-member
else:
webbrowser.open_new_tab("file://{}".format(fname))
webbrowser.open_new_tab(f"file://{fname}")


def args_in_kwargs(args, kwargs):
Expand Down