Skip to content

Commit c475cbf

Browse files
committed
Use absolute path for the pager.
Fixes satwikkansal#119
1 parent 596186d commit c475cbf

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

wtfpython-pypi/wtf_python/main.py

+6-3
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 = ("https://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') 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)