1
0
mirror of https://github.com/satwikkansal/wtfpython synced 2024-11-12 14:38:52 +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 committed by Satwik
parent 290921fe12
commit 3479b2befb

View File

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