manim/scripts/make_and_open_docs.py
Kapil Sachdeva 4237e00edc
fix - use absolute path in make_and_open_docs.py (#1048)
* fix - use absolute path in make_and_open_docs.py

* use as_uri on the absolute path to build the URI
2021-02-26 07:06:38 +01:00

13 lines
420 B
Python

from pathlib import Path
import os
import sys
import webbrowser
path_makefile = Path(__file__).parents[1] / "docs"
os.system(f"cd {path_makefile} && make html")
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}")