We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 596186d commit c475cbfCopy full SHA for c475cbf
wtfpython-pypi/wtf_python/main.py
@@ -1,3 +1,5 @@
1
+from os.path import dirname, join, realpath
2
+
3
import pydoc
4
try:
5
from urllib.request import urlretrieve
@@ -6,13 +8,14 @@
6
8
7
9
url = ("https://raw.githubusercontent.com/satwikkansal/"
10
"wtfpython/master/README.md")
-file_name = "content.md"
11
12
+file_path = join(dirname(dirname(realpath(__file__))), "content.md")
13
14
15
def fetch_updated_doc():
16
17
print("Fetching the latest version...")
- urlretrieve(url, file_name)
18
+ urlretrieve(url, file_path)
19
print("Done!")
20
except Exception as e:
21
print(e)
@@ -21,7 +24,7 @@ def fetch_updated_doc():
24
22
25
23
26
def render_doc():
- with open(file_name, 'r') as f:
27
+ with open(file_path, 'r', encoding="utf-8") as f:
28
content = f.read()
29
pydoc.pager(content)
30
0 commit comments