From: Éric Araujo Date: Fri, 25 Mar 2011 19:31:50 +0000 (+0100) Subject: Use universal construct os.path.expanduser('~') instead of os.environ['HOME'] X-Git-Tag: v3.2.1b1~209^2^2^2~2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=4dcf50250c24748b4a49bc4482752eb382d663ee;p=python Use universal construct os.path.expanduser('~') instead of os.environ['HOME'] --- diff --git a/Doc/library/http.cookiejar.rst b/Doc/library/http.cookiejar.rst index 1aafec91e9..74d8d1626a 100644 --- a/Doc/library/http.cookiejar.rst +++ b/Doc/library/http.cookiejar.rst @@ -719,7 +719,7 @@ cookies (assumes Unix/Netscape convention for location of the cookies file):: import os, http.cookiejar, urllib.request cj = http.cookiejar.MozillaCookieJar() - cj.load(os.path.join(os.environ["HOME"], ".netscape/cookies.txt")) + cj.load(os.path.join(os.path.expanduser("~"), ".netscape", "cookies.txt")) opener = urllib.request.build_opener(urllib.request.HTTPCookieProcessor(cj)) r = opener.open("http://example.com/") diff --git a/Doc/library/readline.rst b/Doc/library/readline.rst index 218f81ea9c..ab7b4b6ecb 100644 --- a/Doc/library/readline.rst +++ b/Doc/library/readline.rst @@ -197,7 +197,7 @@ normally be executed automatically during interactive sessions from the user's import os import readline - histfile = os.path.join(os.environ["HOME"], ".pyhist") + histfile = os.path.join(os.path.expanduser("~"), ".pyhist") try: readline.read_history_file(histfile) except IOError: