1
0
mirror of https://github.com/satwikkansal/wtfpython synced 2024-11-25 20:44:24 +01:00

Use absolute path for the pager.

Fixes https://github.com/satwikkansal/wtfpython/issues/119
This commit is contained in:
Satwik Kansal 2019-05-01 19:55:46 +05:30
parent 596186d81c
commit c475cbfe82

View File

@ -1,3 +1,5 @@
from os.path import dirname, join, realpath
import pydoc import pydoc
try: try:
from urllib.request import urlretrieve from urllib.request import urlretrieve
@ -6,13 +8,14 @@ except ImportError:
url = ("https://raw.githubusercontent.com/satwikkansal/" url = ("https://raw.githubusercontent.com/satwikkansal/"
"wtfpython/master/README.md") "wtfpython/master/README.md")
file_name = "content.md"
file_path = join(dirname(dirname(realpath(__file__))), "content.md")
def fetch_updated_doc(): def fetch_updated_doc():
try: try:
print("Fetching the latest version...") print("Fetching the latest version...")
urlretrieve(url, file_name) urlretrieve(url, file_path)
print("Done!") print("Done!")
except Exception as e: except Exception as e:
print(e) print(e)
@ -21,7 +24,7 @@ def fetch_updated_doc():
def render_doc(): def render_doc():
with open(file_name, 'r') as f: with open(file_path, 'r', encoding="utf-8") as f:
content = f.read() content = f.read()
pydoc.pager(content) pydoc.pager(content)