Achille Fouilleulos.system -> subprocess (#3955)0a96aac2 years agoHistory
15 lines · 480 B · Python
RawDownload
from __future__ import annotations import subprocessimport sysimport webbrowserfrom pathlib import Path path_makefile = Path(__file__).resolve().parents[1] / "docs"subprocess.run(["make", "html"], cwd=path_makefile) website = (path_makefile / "build" / "html" / "index.html").absolute().as_uri()try:  # Allows you to pass a custom browser if you want.    webbrowser.get(sys.argv[1]).open_new_tab(f"{website}")except IndexError:    webbrowser.open_new_tab(f"{website}")