Skip to content

Commit 3479b2b

Browse files
committed
Use absolute path for the pager.
Fixes satwikkansal#119
1 parent 290921f commit 3479b2b

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

wtfpython-pypi/wtf_python/main.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
from os.path import dirname, join, realpath
2+
13
import pydoc
24
try:
35
from urllib.request import urlretrieve
@@ -6,13 +8,14 @@
68

79
url = ("http://raw.githubusercontent.com/satwikkansal/"
810
"wtfpython/master/README.md")
9-
file_name = "content.md"
11+
12+
file_path = join(dirname(dirname(realpath(__file__))), "content.md")
1013

1114

1215
def fetch_updated_doc():
1316
try:
1417
print("Fetching the latest version...")
15-
urlretrieve(url, file_name)
18+
urlretrieve(url, file_path)
1619
print("Done!")
1720
except Exception as e:
1821
print(e)
@@ -21,7 +24,7 @@ def fetch_updated_doc():
2124

2225

2326
def render_doc():
24-
with open(file_name, 'r', encoding='utf-8') as f:
27+
with open(file_path, 'r', encoding="utf-8") as f:
2528
content = f.read()
2629
pydoc.pager(content)
2730

0 commit comments

Comments
 (0)