]> granicus.if.org Git - python/commitdiff
Use universal construct os.path.expanduser('~') instead of os.environ['HOME']
authorÉric Araujo <merwok@netwok.org>
Fri, 25 Mar 2011 19:31:50 +0000 (20:31 +0100)
committerÉric Araujo <merwok@netwok.org>
Fri, 25 Mar 2011 19:31:50 +0000 (20:31 +0100)
Doc/library/http.cookiejar.rst
Doc/library/readline.rst

index 1aafec91e9fe802b35486be8419e4b3e8eb91942..74d8d1626a83494e0aab34bdd8c52103ff1e5aa6 100644 (file)
@@ -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/")
 
index 218f81ea9cdfe218415d02c695e066043adb2917..ab7b4b6ecbcb13cf40e4351afb336ae363c707c8 100644 (file)
@@ -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: